I am getting following error on trying to OAuth with Google APIs, using Named Credentials. This error comes after doing OAuth dance via

  1. Setup > Named Credentials or
  2. My Settings > Authentication Settings for External Systems

My Settings > Authentication Settings for External Systems

To get refresh token, I added access_type=offline at the end of AUTH url (pic below). But its not working out.

enter image description here

Anything I am missing here ?


In the Auth. Provider, set Provider Type to 'Open ID Connect' (not 'Google'), and in 'Authorize Endpoint URL' put 'https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force'. In Named Credential, include 'openid' as the first scope, you can add any other Google scopes after that. Read more: https://developer.salesforce.com/docs/atlas.en-us.noversion.mobile_sdk.meta/mobile_sdk/sso_provider_openid_connect.htm


Here is an example on how to use named credentials with google apis!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.