Auth0 Home Blog Docs

Logged in user calling my api

authentication

#1

I’ve created a new client in the dashboard.

I’ve also created an API in the dashboard for my asp.net core web api.

I have a username password connection for a database.

Using the Auth0 Authentication API which endpoint can I call to specify a username/password and get back a token that I can use to Authorize that user in my web api (and have the user profile available in User.Identity)?

I’ve tried /oauth/ro and get back an id_token and when I use postman I get back Bearer error=“invalid_token”, error_description=“The audience is invalid”)

I’ll be using lock in my mobile app, but for testing the api integration I want to be able to login as a user programmatically and call my API. I also notice that the API client in the dashboard allows you to test authentication with an api token, but this isn’t in the context of a specific user. I’d like all authentication to be based on the context of a user.


#2

You will want to be executing the Authorization Code grant flow with PKCE, in order to call your API on behalf of a user, from a mobile app.
https://auth0.com/docs/api-auth/grant/authorization-code-pkce

The step by step details of executing the flow are available here:
https://auth0.com/docs/api-auth/tutorials/authorization-code-grant-pkce


#3