I am following this Ruby Gmail API quickstart guide to authorize a user for the Gmail API. I've created a Web Application
type app at Google console and generated it's credentials.json file(and placed it alongside the quickstart.rb). I've provided a redirect_uri
to the app which is hosted as a rails app on heroku. The url is in the format as below
https://myapp-api-heroku.com/my_redirect_endpoint
When I run the quickstart.rb, it displays the following message in console
Open the following URL in the browser and enter the resulting code after authorization: https://accounts.google.com/o/oauth2/auth?access_type=offline&approval_prompt=force&client_id=my_client_id_here&include_granted_scopes=true&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/gmail.readonly
After I open the link in the browser it displays this error
The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob, can only be used by a Client ID for native application. It is not allowed for the WEB client type. You can create a Client ID for native application at https://console.developers.google.com/apis/credentials/oauthclient
I've registered the provided redirect_uri at the google console in the respective application. I'm unable to find what it causing this issue.I eventually want to call this Gmail API from my rails app server, but I'm unable to proceed further.