I am currently developing the web component for Google Api cross client authorization as described in this article.
Additionally, the environment that I am in is Rails and so I am using the google-api-client gem as described in this article https://developers.google.com/identity/protocols/OAuth2WebServer#handlingtheresponse
The authorization code is obtained via the android app using the web client ID and passed onto the web api in order to exchange it. My use of the gem and code to exchange is as follows
auth_client = Google::APIClient::ClientSecrets.load("/path/to/client_secrets.json").to_ authorization auth_client.code = code auth_client.fetch_access_token!
I’ve additionally tried doing
auth_client = Google::APIClient::ClientSecrets.load("/path/to/client_secrets.json").to_ authorization auth_client.update!( :grant_type => 'authorization_code' ) auth_client.code = code auth_client.fetch_access_token!
In all cases I receive an invalid grant error from Google with no description.
I have tried to construct the urls to curl directly, and circumvent the gem, using the google oauth playground without any success.
Any insight into what maybe generating the invalid grant errors or how to generate the curl requests to exchange the token directly with google outside of the gem would be greatly appreciated.