Question:
How to set the Approval Prompt to Auto? It defaults to ‘approval_prompt=force’
Code:
I am setting up the client like this.
@client = Google::APIClient.new(
:authorization => :oauth_2,
:host => 'www.googleapis.com',
:http_adapter => HTTPAdapter::NetHTTPAdapter.new
)
@client.authorization.client_id = 'xxxx.apps.googleusercontent.com'
@client.authorization.client_secret = 'xxxx'
Context: Google OAuth2
Client Library: google-api-ruby-client
Reference: Same question for the php client :
Google+ OAuth API store and retrieve tokens after first login and authorization
Signet Documentation. I can’t find the approval_prompt setter
http://signet.rubyforge.org/api/Signet/OAuth2/Client.html
This is how I solved the problem.
I wrote a separate helper method that will generate the Google OAuth URI
end
Next, instead of referring to Google OAuth URI directly in my view, I called the helper.
That did the trick.