# Can we obtain Access Token for our API without any authentication happening before?

**URL:** <https://community.auth0.com/t/can-we-obtain-access-token-for-our-api-without-any-authentication-happening-before/58631>\
**Category:** Get Help\
**Tags:** jwt, api, login\
**Created:** [February 27, 2021, 10:31pm UTC](https://community.auth0.com/t/can-we-obtain-access-token-for-our-api-without-any-authentication-happening-before/58631 "2021-02-27T22:31:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clubbing](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/clubbing/32/12811_2.png) [@clubbing](https://community.auth0.com/u/clubbing)\
**Post date:** [February 27, 2021, 10:31pm UTC](https://community.auth0.com/t/can-we-obtain-access-token-for-our-api-without-any-authentication-happening-before/58631/1 "2021-02-27T22:31:13Z")

</div>

Hi.

Our REST API requires an access token. For specific Endpoints, a valid JWT token containing an authenticated user is required, for some others not.

However, as far as I know, to retrieve access tokens using Auth0 will require a valid user login.  
Is it possible to have both worlds? To obtain an Access token without any requirements (like as an “Anonymous”) and obtain access tokens requiring authenticated users?

Many Thanks in advance!

---

<div class="post-metadata">

**Author:** ![ricardo.batista](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ricardo.batista/32/7711_2.png) [@ricardo.batista](https://community.auth0.com/u/ricardo.batista)\
**Post date:** [March 1, 2021, 12:01pm UTC](https://community.auth0.com/t/can-we-obtain-access-token-for-our-api-without-any-authentication-happening-before/58631/2 "2021-03-01T12:01:38Z")

</div>

Hi @clubbing

You can retrieve access tokens without a user login by using the Client Credentials flow. With machine-to-machine (M2M) applications, such as CLIs, daemons, or services running on your back-end, the system authenticates and authorizes the app rather than a user. You’ll just need to provide the client id and secret to get a valid access token back. Please see more info here:

> **[Client Credentials Flow](https://auth0.com/docs/get-started/authentication-and-authorization-flow/client-credentials-flow)**
>
> Learn how the Client Credentials flow works and why you should use it for machine-to-machine (M2M) applications.

---

<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 16, 2021, 12:01pm UTC](https://community.auth0.com/t/can-we-obtain-access-token-for-our-api-without-any-authentication-happening-before/58631/3 "2021-03-16T12:01:42Z")

</div>

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