# Obtaining user access\_tokens without login

**URL:** <https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344>\
**Category:** Get Help\
**Tags:** api\
**Created:** [December 25, 2020, 2:36pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344 "2020-12-25T14:36:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![trackers153](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/trackers153/32/13766_2.png) [@trackers153](https://community.auth0.com/u/trackers153)\
**Post date:** [December 25, 2020, 2:36pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/1 "2020-12-25T14:36:36Z")

</div>

Hi, I am trying to test accessing the /userinfo endpoint and am wondering if I can obtain an access token using the Auth0 Management API-\>Test with Client ID/secret and user\_id/email, without having to go through the login process. I would then send the access token to /userinfo to get user information (e.g. email). Normally, the users would login through the app (SPA), but this is for testing purposes. Thx

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 28, 2020, 8:26pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/3 "2020-12-28T20:26:05Z")

</div>

Hi @trackers153,

We don’t support user impersonation due to a variety of security concerns. We would recommend creating test users for this type of applicaiton.

---

<div class="post-metadata">

**Author:** ![trackers153](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/trackers153/32/13766_2.png) [@trackers153](https://community.auth0.com/u/trackers153)\
**Post date:** [January 6, 2021, 12:01am UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/4 "2021-01-06T00:01:04Z")

</div>

The issue isn’t with creating test users, the issue is with obtaining an access token for that test user. Can you recommend a command line method where I can supply the test user’s credentials (login/password) and get back a Bearer token to test with?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 6, 2021, 4:42pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/5 "2021-01-06T16:42:04Z")

</div>

The resource owner password grant will act like you are describing. You can activate it for your command line app temporarily, then disable it when testing is complete.

> **[Resource Owner Password Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/resource-owner-password-flow)**
>
> Learn how the Resource Owner Password flow works and why you should use it for highly-trusted applications.

---

<div class="post-metadata">

**Author:** ![trackers153](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/trackers153/32/13766_2.png) [@trackers153](https://community.auth0.com/u/trackers153)\
**Post date:** [January 7, 2021, 6:29pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/6 "2021-01-07T18:29:14Z")

</div>

This worked, thank you Dan. To confirm, the setting which enables this workflow is Grant Types: Password which allows the application (CLI/cURL in this case) to obtain and submit a password itself, as opposed to redirecting the end user to an Auth0 server and the end user entering the password there?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [January 7, 2021, 6:43pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/7 "2021-01-07T18:43:43Z")

</div>

@trackers153,

The description you just gave sounds correct to me. Here is the API documentation if you want to see more about it:

[https://auth0.com/docs/api/authentication#resource-owner-password](https://auth0.com/docs/api/authentication#resource-owner-password)

If you haven’t already, read the warnings about using this flow. It has some added risks that you should understand and address. This info is available in the original doc I linked and the related docs.

---

<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:** [January 22, 2021, 6:43pm UTC](https://community.auth0.com/t/obtaining-user-access-tokens-without-login/55344/8 "2021-01-22T18:43:54Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
