# Generate customer's tokens for backend API

**URL:** <https://community.auth0.com/t/generate-customers-tokens-for-backend-api/88955>\
**Category:** Get Help\
**Tags:** backend, api, user, auth0\
**Created:** [August 18, 2022, 12:01pm UTC](https://community.auth0.com/t/generate-customers-tokens-for-backend-api/88955 "2022-08-18T12:01:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![naf](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/naf/32/39388_2.png) [@naf](https://community.auth0.com/u/naf)\
**Post date:** [August 18, 2022, 12:01pm UTC](https://community.auth0.com/t/generate-customers-tokens-for-backend-api/88955/1 "2022-08-18T12:01:54Z")

</div>

Hi there. What I have:

- SPA
- Backend with API
- Customers (i.e. users)
- Organizations (user might be in several organizations at the same time)

What I want:

- Implement some public API at my backend
- User want to have their own token to request my backend public API without my SPA (for example, user wants to make cron script)
- This token should be on Organization level (not for user, i.e. user with such privilege releases token for organization)
- This token should contain organization ID (my backend has to route this request into right organization)

What I don’t understand:

- All things 🙃 (just a joke)
- How to create token? I found docs [Get refresh tokens](https://auth0.com/docs/secure/tokens/refresh-tokens/get-refresh-tokens) how to build similar system, but there no options. Does Auth0 support only this flow?
- What should I do if I want to use only one token (like access\_token) for all time, without refreshing?
- May I release token without user’s request to auth0’s /authorize handler?
- Should I create any Auth0 Application for that case? Which one (Regular app, M2M, …)?

Hope, I was understandable 😃

---

<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:** [August 24, 2022, 4:30pm UTC](https://community.auth0.com/t/generate-customers-tokens-for-backend-api/88955/3 "2022-08-24T16:30:44Z")

</div>

Hi @naf,

Welcome to the Auth0 Community!

It sounds like you are describing [First-Party and Third-Party Applications](https://auth0.com/docs/get-started/applications/confidential-and-public-applications/first-party-and-third-party-applications). Auth0 supports registering Third Party Applications, which would allow your customers/developers the ability to request their own tokens for use with your API.

I’ll try to answer a few of your questions too:

> [@naf](#):
>
> What should I do if I want to use only one token (like access\_token) for all time, without refreshing?

It sounds like you are describing an API key, which is something we don’t support. All access tokens have an expiration, and you will need a refresh token to create a session that doesn’t expire.

The doc I linked has some information about how to set this up, but feel free to let me know if you have any questions.

---

<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:** [September 30, 2022, 11:06pm UTC](https://community.auth0.com/t/generate-customers-tokens-for-backend-api/88955/4 "2022-09-30T23:06:01Z")

</div>


