How to generate token for user logged?


I want to generate a token for a user logged so I can call auth 0 api.

For example I log in with a user and I want to change my password, for that I need to call the api with a token for that user.

how I get that token?

Depending on what type of app you have, you can either use the Management API directly, or our Authentication API.

Using our Management API requires that the client (your app) contacting our API is highly trusted, because you’ll first need to obtain a Management API access token. This involves storing client_id and client_secret on the app’s side.

The best option from a security standpoint is to use the Authentication API to issue a password reset flow. The user would get an email with a link that they have to click to change their password.

you mean clicking forgot password when log in?

If you use the POST https://YOUR_DOMAIN/dbconnections/change_password API endpoint, Auth0 will send the user an email with a link they can click to change their password. It’s similar to the Forgot Password link in Lock or Universal Login, but by using the API endpoint, your app can issue the password change email on demand.

Per the document I linked above:

If your application uses an interactive password reset flow using the Authentication API, make a POST call specifying the email address of the user account whose password you would like to reset in the email field. If the call is successful, the user will receive an email prompting them to change their password.