Log in a user programatically \ generate user token programatically

Hi,

I’m trying to find the best practice to log in my user alternatively, i.e not from a UI dashboard.

I have another entry point for my application, in which a user comes from a trusted source and is after authentication.

I would have used something like machine to machine authentication, because it is two backends talking, but I want to retain the user information I get with a proper sign in token.

I want to be able to log them in or at least generate a token that contains the same information as if they would have logged in from the UI.

Using an SSO would be best, but the other backend isn’t using auth0 as well.

What’s the best, clean way to achieve this kind of thing?

Appreciate any response, thanks

Hi @it15

Welcome to the Auth0 Community!

If you do not wish to redirect your users to the Auth0 Universal Login UI for authentication, I would recommend using our Authentication API in order to receive tokens(ID, Access and Refresh tokens as well) for your users and have access to their information by decoding them.

You an refer to our documentation about the Resource Owner Password Flow. You also have a bunch of other options available depending on your use case in our Authentication API documentation.

If you have any other questions, let me know!

Kind Regards,
Nik