# Create token using API with custom claim

**URL:** <https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [March 9, 2023, 7:26am UTC](https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132 "2023-03-09T07:26:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![akgupta317](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/akgupta317/32/45091_2.png) [@akgupta317](https://community.auth0.com/u/akgupta317)\
**Post date:** [March 9, 2023, 7:26am UTC](https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132/1 "2023-03-09T07:26:16Z")

</div>

can we create a token using API with a custom token?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [March 11, 2023, 12:31am UTC](https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132/3 "2023-03-11T00:31:53Z")

</div>

Hi there @akgupta317 welcome to the community!

Are you able to expand on your specific desired use case here so that we might be able to understand your question a bit better?

Thanks!

---

<div class="post-metadata">

**Author:** ![akgupta317](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/akgupta317/32/45091_2.png) [@akgupta317](https://community.auth0.com/u/akgupta317)\
**Post date:** [March 13, 2023, 7:24am UTC](https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132/4 "2023-03-13T07:24:20Z")

</div>

yes, @tyf  
we want to create an access\_token for a user with a custom claim via Management API.

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [March 13, 2023, 9:24pm UTC](https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132/5 "2023-03-13T21:24:03Z")

</div>

Gotcha, thanks for clarifying!

The most straightforward way to get an access token for a user is to use the resource owner password flow against the `/oauth/token` endpoint of the Authentication API:

> **[Auth0 Authentication API](https://auth0.com/docs/api/authentication#resource-owner-password)**

You’ll need to make sure whatever `client_id` you are setting has the password grant enabled in the application settings in your dashboard (settings → advanced settings → grant types).

You can add custom claims to the token with an Action which will execute when the user logs in:

[https://community.auth0.com/t/adding-custom-claims-to-tokens/84590](https://community.auth0.com/t/adding-custom-claims-to-tokens/84590)

Hope this helps!

---

<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 27, 2023, 9:24pm UTC](https://community.auth0.com/t/create-token-using-api-with-custom-claim/102132/6 "2023-03-27T21:24:23Z")

</div>

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