I want to retrieve access_token and refresh_token in my rails app from code I get from Javascript for google plus

251 Views Asked by At

My code looks like this .Can anyone help with it

 PLUS_LOGIN_SCOPE = 'https://www.googleapis.com/auth/plus.login'
 $credentials = Google::APIClient::ClientSecrets.load
 $authorization = Signet::OAuth2::Client.new(
 :authorization_uri => $credentials.authorization_ur
 :token_credential_uri => $credentials.token_credential_uri
 :client_id => $credentials.client_id
 :client_secret => $credentials.client_secret
 :redirect_uri => $credentials.redirect_uris.first
 :scope => PLUS_LOGIN_SCOPE)
 $client = Google::APIClient.new
 $authorization.code = request.headers["HTTP_AUTHORIZATION"]

I get error in this line which states

 $authorization.fetch_access_token!

   Signet::AuthorizationError: Authorization failed.  Server  message:
   {
       "error" : "deleted_client",
       "error_description" : "The OAuth client was deleted."
   }
0

There are 0 best solutions below