# Assistance Needed: Modifying Access Token Scope in Machine to Machine Application

**URL:** <https://community.auth0.com/t/assistance-needed-modifying-access-token-scope-in-machine-to-machine-application/132870>\
**Category:** Get Help\
**Tags:** actions-management-api, management-api\
**Created:** [April 26, 2024, 11:46am UTC](https://community.auth0.com/t/assistance-needed-modifying-access-token-scope-in-machine-to-machine-application/132870 "2024-04-26T11:46:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sakshi05](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sakshi05/32/56701_2.png) [@Sakshi05](https://community.auth0.com/u/Sakshi05)\
**Post date:** [April 26, 2024, 11:46am UTC](https://community.auth0.com/t/assistance-needed-modifying-access-token-scope-in-machine-to-machine-application/132870/1 "2024-04-26T11:46:02Z")

</div>

How can I update the access token in a Machine to Machine application using Actions? I’ve referred to the official documentation, but I couldn’t find a method to update the “scope” claim. While I can set custom claims, modifying the “scope” claim seems elusive. Can you provide guidance on this?

Official Doc :

> **[Actions Triggers: credentials-exchange - API Object](https://auth0.com/docs/customize/actions/flows-and-triggers/machine-to-machine-flow/api-object)**
>
> Learn about the credentials-exchange Action trigger's API object.

Here’s the snippet I’ve been using to add a new claim:

exports.onExecuteCredentialsExchange = async (event, api) =\> {  
// Set the custom claim for the access token  
api.accessToken.setCustomClaim(‘[http://scope](http://scope)’, ‘free’);  
};

I’d appreciate any assistance you can offer.

---

<div class="post-metadata">

**Author:** ![dawid.matuszczyk](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dawid.matuszczyk/32/74550_2.png) [@dawid.matuszczyk](https://community.auth0.com/u/dawid.matuszczyk)\
**Post date:** [April 26, 2024, 12:42pm UTC](https://community.auth0.com/t/assistance-needed-modifying-access-token-scope-in-machine-to-machine-application/132870/2 "2024-04-26T12:42:47Z")

</div>

Hi @Sakshi05

Welcome to the Auth0 Community!

Thank you for posting your question. As for now with the usage of Actions you are only able to add or remove scope from access token

> ## Access Token Scope
> 
> - `api.accessToken.addScope(scope)`
> - `api.accessToken.removeScope(scope)`

If you find this feature missing or necessary please open a topic in the #Feedback category so other community members can vote on it. Our Product team is constantly checking for a new feature opportunities.

Thanks  
Dawid

---

<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:** [May 10, 2024, 12:43pm UTC](https://community.auth0.com/t/assistance-needed-modifying-access-token-scope-in-machine-to-machine-application/132870/3 "2024-05-10T12:43:19Z")

</div>

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