# Suppressing Auth0 consent screen when sending prompt: “consent” to Google?

**URL:** <https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427>\
**Category:** Get Help\
**Tags:** google-social-connection, connections\
**Created:** [October 12, 2023, 6:54pm UTC](https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427 "2023-10-12T18:54:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cronjob](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/cronjob/32/49123_2.png) [@cronjob](https://community.auth0.com/u/cronjob)\
**Post date:** [October 12, 2023, 6:54pm UTC](https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427/1 "2023-10-12T18:54:28Z")

</div>

Hi Auth0 Community,

I’m building a React web app using the @auth0/auth0-react library. Users of this app are only allowed to authenticate with Google OAuth2. After initial authentication, users have the option to connect to Gmail. That is, they can give [https://www.googleapis.com/auth/gmail.readonly](https://www.googleapis.com/auth/gmail.readonly) scope access. These flows both rely on Auth0.

My implementation involves two nested `Auth0Provider` components, one for the initial login and a second for adding Gmail access. Below are the options I pass to each:

```auto
export const googleProviderConfig = {
  context: GoogleAuth0ProviderContext,
  domain: process.env.REACT_APP_AUTH0_DOMAIN,
  clientId: process.env.REACT_APP_AUTH0_CLIENT_ID,
  authorizationParams: {
    audience: process.env.REACT_APP_AUTH0_AUDIENCE,
    redirectUri: `${window.location.origin}?primary`,
    scope: "openid profile",
    connection: "google-oauth2",
  },
  skipRedirectCallback: window.location.href.includes("?gmail"),
};

export const gmailProviderConfig = {
  context: GmailAuth0ProviderContext,
  domain: process.env.REACT_APP_AUTH0_DOMAIN,
  clientId: process.env.REACT_APP_AUTH0_CLIENT_ID,
  authorizationParams: {
    redirectUri: `${window.location.origin}?gmail`,
    scope: "openid profile",
    connection: "google-oauth2",
    connection_scope: "https://www.googleapis.com/auth/gmail.readonly",
    access_type: "offline",
    // prompt: "select_account",
    prompt: "select_account consent",
  },
  skipRedirectCallback: window.location.href.includes("?primary"),
};

```

As I’ve implemented the flows, everything works well, with one exception. The problem happens when my app needs to get the offline access refresh token again for some reason. My app can let the user know the connection is broken and display a “Connect with Gmail” button. However, after the auth flow, there is no new refresh token unless I include `prompt: “consent”`. This is fine, I don’t mind asking users to review the Google Gmail consent screen again. The problem is that when I include `prompt: “consent”` I also get the Auth0 consent screen:

 ![imagez](https://global.discourse-cdn.com/auth0/original/3X/8/e/8e0df4d420e98f11dcb2d54f26214d3fd9be908d.png)

And, this screen is confusing for users…

I’ve seen other posts in which folks had similar issues. For example:

> [@How to force \`prompt: "consent"\` only to the google authentication?](https://community.auth0.com/t/how-to-force-prompt-consent-only-to-the-google-authentication/49558):
>
> We are able to get the refresh\_token successfully by using prompt: "consent" in the auth.params. As shown below: { allowAutocomplete: true allowedConnections: ["google-oauth2"] auth:{ access\_type: "offline" connectionScopes: {google-oauth2: ...} params: { access\_type: "offline", state: "shgs84s90kksa\_kdd2kdnisdgigg3ng", prompt: "consent", scope: "openid profile email" } } responseType: "token id…

However, I’ve already got the suggested solutions in place—specifically, no references to localhost in Allowed Callback URLs.

I’d appreciate any suggestions. I’m also happy to post more of the code or a link to a demo if the community needs more detail. Also, if there is sample code for achieving the incremental scope increases for Google, I’d appreciate a link, so I can compare my code.

Thanks,

John

---

<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:** [October 18, 2023, 3:18pm UTC](https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427/3 "2023-10-18T15:18:49Z")

</div>

Hi @cronjob,

I think you should be using the [Pass Parameters to Identity Providers](https://auth0.com/docs/authenticate/identity-providers/pass-parameters-to-idps) `upstream_params` to pass the the prompt for consent directly to google.

Have you looked into that?

---

<div class="post-metadata">

**Author:** ![cronjob](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/cronjob/32/49123_2.png) [@cronjob](https://community.auth0.com/u/cronjob)\
**Post date:** [October 18, 2023, 10:34pm UTC](https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427/4 "2023-10-18T22:34:24Z")

</div>

@dan.woda You are the Man. Thank you.

---

<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:** [October 19, 2023, 1:30pm UTC](https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427/5 "2023-10-19T13:30:55Z")

</div>

Thanks @cronjob! Let me know if you have any other questions.

---

<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:** [November 2, 2023, 1:31pm UTC](https://community.auth0.com/t/suppressing-auth0-consent-screen-when-sending-prompt-consent-to-google/118427/6 "2023-11-02T13:31:53Z")

</div>

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