# Change the grant\_type using React SDK

**URL:** <https://community.auth0.com/t/change-the-grant-type-using-react-sdk/86057>\
**Category:** Get Help\
**Tags:** auth0-react, react, grant-types, auth0\
**Created:** [June 28, 2022, 10:26am UTC](https://community.auth0.com/t/change-the-grant-type-using-react-sdk/86057 "2022-06-28T10:26:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuv-c](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yuv-c/32/38420_2.png) [@yuv-c](https://community.auth0.com/u/yuv-c)\
**Post date:** [June 28, 2022, 10:26am UTC](https://community.auth0.com/t/change-the-grant-type-using-react-sdk/86057/1 "2022-06-28T10:26:32Z")

</div>

Hello.  
I’m currently in the process of migrating from the auth0-js SDK to auth0/auth0-react SDK.

I’ve wrapped my `app` in an Auth0Provider component with the following props:

```auto
domain={'...'}
audience={'https://...'}
clientId={'...'}
redirectUri={window.location.origin}
scope={'openid email profile <scopes...>'}
useRefreshTokens={true}

```

When i call

```const
token = await getAccessTokenSilently({
      audience: 'https://...,
      scope: '<...>'
    });

```

I get the following error message in the developer tools:

> Silent callback error: error=unauthorized\_client&error\_description=Grant type ‘authorization\_code’ not allowed for the client.

The auth0-js settings before the migration to react SDK were:

```auto
// ***PREVIOUS SETTINGS***
const auth0Client = new auth0.WebAuth({
  domain: '...',
  audience: 'h...',
  clientID: '...', 
  redirectUri: window.location.origin,
  responseType: 'token id_token',
  scope: 'openid email profile <...>'
});

```

Since I can’t pass to Auth0Provider component the responseType property like i previously did, how can I set the grant type to `token id_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:** [July 1, 2022, 11:10pm UTC](https://community.auth0.com/t/change-the-grant-type-using-react-sdk/86057/2 "2022-07-01T23:10:19Z")

</div>

Hi @yuv-c !

> [@yuv-c](#):
>
> Silent callback error: error=unauthorized\_client&error\_description=Grant type ‘authorization\_code’ not allowed for the client.

This should be able to be resolved by allowing the Authorization Code grant type in the relevant Application’s [settings](https://auth0.com/docs/get-started/applications/update-grant-types#:~:text=Go%20to%20Dashboard%20%3E%20Applications%20%3E%20Applications,appropriate%20grants%20for%20the%20application.). I assume you are using a SPA app configured in Auth0?

Out of curiosity, is there a particular reason you are looking to use the implicit grant type with the React SDK? It’s recommended to use Authorization Code (+ PKCE) whenever possible as outlined in the following blog post:

> **[OAuth2 Implicit Grant and SPA](https://auth0.com/blog/oauth2-implicit-grant-and-spa/#:~:text=Auth0%20Docs&text=Namely%2C%20it%20suggests%20to%20use,implicit%20grant%20for%20that%20scenario)**
>
> Everything you always wanted to know (but were afraid to ask)

Let us know you thoughts and we can go from there!

---

<div class="post-metadata">

**Author:** ![yuv-c](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/yuv-c/32/38420_2.png) [@yuv-c](https://community.auth0.com/u/yuv-c)\
**Post date:** [July 6, 2022, 7:06am UTC](https://community.auth0.com/t/change-the-grant-type-using-react-sdk/86057/3 "2022-07-06T07:06:06Z")

</div>

Thank you @ty.frith.  
Though this is doesn’t directly answer what I asked (“how can I set the grant type to `token id_token`?”)  
We are currently using implicit grant type in our existing app for a while now.  
I will look into using authorization code with PKCE instead of implicit.

---

<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:** [July 21, 2022, 7:06am UTC](https://community.auth0.com/t/change-the-grant-type-using-react-sdk/86057/4 "2022-07-21T07:06:11Z")

</div>

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