# Login flow & is there a way to avoid redirecting the user in order to use our API?

**URL:** <https://community.auth0.com/t/login-flow-is-there-a-way-to-avoid-redirecting-the-user-in-order-to-use-our-api/6479>\
**Category:** Get Help\
**Tags:** authorization-code-f, mobile, user, user-creation\
**Created:** [May 4, 2017, 2:05pm UTC](https://community.auth0.com/t/login-flow-is-there-a-way-to-avoid-redirecting-the-user-in-order-to-use-our-api/6479 "2017-05-04T14:05:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![valwallace](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@valwallace](https://community.auth0.com/u/valwallace)\
**Post date:** [May 4, 2017, 2:05pm UTC](https://community.auth0.com/t/login-flow-is-there-a-way-to-avoid-redirecting-the-user-in-order-to-use-our-api/6479/1 "2017-05-04T14:05:59Z")

</div>

We’re building a mobile app and a corresponding API for this app to call.

Our goal is to log in the user and then use `access_token`s to authenticate them on the backend whenever our app makes an API call.

Is there a way to avoid redirecting the user to give permission to use our API after they log in? OR is there a way to authenticate them to call our API _during_ login? It seems weird that users have to take extra steps in order for our app to call our own API.

One possibility I see would be for us to use the `id_token` given upon login to authenticate the user on the backend upon API call, but I realize that’s not what an `id_token` is for. Is this a valid option?

---

<div class="post-metadata">

**Author:** ![jmangelo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jmangelo/32/7923_2.png) [@jmangelo](https://community.auth0.com/u/jmangelo)\
**Post date:** [May 8, 2017, 7:56pm UTC](https://community.auth0.com/t/login-flow-is-there-a-way-to-avoid-redirecting-the-user-in-order-to-use-our-api/6479/2 "2017-05-08T19:56:13Z")

</div>

If you don’t want redirects you can make use of the resource owner password grant and collect the user’s credentials within your mobile application. You could then exchange those credentials with the suitable access token for calling your API. As part of the exchange you could also request a refresh token so that the user would not have to always be providing the credentials to your application.

For more information see:

- [Resource Owner Password Grant](https://auth0.com/docs/api-auth/grant/password)
- [Execute the Resource Owner Password Grant](https://auth0.com/docs/api-auth/tutorials/password-grant)

---

<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/login-flow-is-there-a-way-to-avoid-redirecting-the-user-in-order-to-use-our-api/6479/3 "2018-03-02T05:53:41Z")

</div>


