# Logged in user calling my api

**URL:** <https://community.auth0.com/t/logged-in-user-calling-my-api/6506>\
**Category:** Get Help\
**Tags:** authentication\
**Created:** [May 6, 2017, 12:23am UTC](https://community.auth0.com/t/logged-in-user-calling-my-api/6506 "2017-05-06T00:23:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nick1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@nick1](https://community.auth0.com/u/nick1)\
**Post date:** [May 6, 2017, 12:23am UTC](https://community.auth0.com/t/logged-in-user-calling-my-api/6506/1 "2017-05-06T00:23:59Z")

</div>

I’ve created a new client in the dashboard.

I’ve also created an API in the dashboard for my [asp.net](http://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.

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [May 8, 2017, 10:05am UTC](https://community.auth0.com/t/logged-in-user-calling-my-api/6506/2 "2017-05-08T10:05:21Z")

</div>

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.

> **[Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-proof-key-for-code-exchange-pkce)**
>
> Learn how the Authorization Code flow with Proof Key for Code Exchange (PKCE) works and why you should use it for native and mobile apps.

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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 2, 2018, 5:53am UTC](https://community.auth0.com/t/logged-in-user-calling-my-api/6506/3 "2018-03-02T05:53:44Z")

</div>


