byjg/php-jwt-session

Life saver

Opened this issue · 1 comments

This is not an issue but i just didn't saw any place.

But i want to thank you so much.

I was looking for how can i use my MySQL users table as log in system in React Native.

It work perfectly using JWT as session.

Thanks you!

byjg commented

Hello Antoine,

First of all thank you for the feedback.

About your question, React Native has another way pretty different than PHP in order to render the HTML page. PHP will render the page for every single request and because this you can check the information on the server and return only the HTML portion you want.

However React Native intends to render the pages locally. To gather data from the server you mostly use API. The API will create and validate the JWT and the React Native will only store locally this token. The requests will return status code 200 or 401 depending on the validation of the JWT and your page should respond accordingly.

Based on this, the project JWT Session will be useless if you intend to use React, React native, Angular, Vue or some similar approach.

To create API in PHP you can use Symfony, Silex, Laravel, etc or you can use a project I developed https://github.com/byjg/php-rest-template. I have some work to do yet, but is pretty functional and has everything I need to create API.