How to link JWT to my users info database
·
Answer a question
I have created a web app and use Auth0 for authentication. Each user has his own page with personal data.
How can I connect an user logged via Auth0 to my Mysql database in order to retrieve and update his specific data?
Answers
The tokens returned from Auth0 contain encoded data. When you decode it you can see for example something like this.
{
"iss": "http://YOUR_DOMAIN/",
"sub": "auth0|123456",
"aud": "YOUR_CLIENT_ID",
"exp": 1311281970,
"iat": 1311280970,
"name": "Jane Doe",
"given_name": "Jane",
"family_name": "Doe",
"gender": "female",
"birthdate": "0000-10-31",
"email": "janedoe@example.com",
"picture": "http://example.com/janedoe/me.jpg"
}
This is the payload of an ID token which I copied from this page. You can connect the Auth0 user and the user data in your database by using a common unique ID. Here you could use sub for example. You can also use the access token. It contains the same sub but some of the other data is missing.
更多推荐
所有评论(0)