Identity Toolkit for Websites v3 provides authorization code signInSuccess callback tokenString argument.
Though //www.gstatic.com/authtoolkit/js/gitkit.js is obfuscate and undocumented, I found .gstatic.com/authtoolkit/js/gitkit-debug.js Which should help, but am still curious if there is a better way or if I'm missing something.
The problem is I cannot find a way to set parameter access_type=offline so I can't get a refresh token, so using Google API Client Library for Java, post login with idp google.com doesn't seem to be an option. I can't use it with the federated login solution offerred. I need to implement the google provider oauth flow separately ... I can't believe that I must be missing something here.
What is the point of providing access to the authorization code in the url # if I can't use it to access other google api's.
In any case back in 2012 someone had the same issue an a solution was provided for v1 seen in [this][2] forum discussion.
The response starts with "Different IdP has different ways to get a refresh token, i.e., for Microsoft, a "wl.offline_access" scope is required; for Google, an "access_type=offline" URL parameter is required. Currently GITKit hasn't yet had a normalized way to do it, but we're looking into it."
If they were looking into it in 2012 surely there is some sort of approach ... in any case my requirement is currently is just to access google api's.
So comparing the flow of google oauth playground where you can select access_type=offline and the account chooser url continue ... looks like this
https://accounts.google.com/AccountChooser?continue=https://accounts.google.com/o/oauth2/auth?
access_type=offline
&approval_prompt=force
&scope=https://www.googleapis.com/auth/cloudprint+https://www.googleapis.com/auth/userinfo.profile
&response_type=code
&redirect_uri=https://developers.google.com/oauthplayground
&client_id=407408718192.apps.googleusercontent.com
&hl=en-GB
&from_login=1
&as=5cc2df3c88f13395
<mpl=popup
&btmpl=authsub
&hl=en_GB
&scc=1
&oauth=1
Where you can see the access_type paramater. I added some extra config properties to gitkit-debug.js in all the right places and then traced execution stepping into functions until the POST was sent, even through my new parameters are in the data all the way up until it is sent I get a url which doesn't include them
screeenshot of debug console showing data object state just before POST
My resulting url continue parameter looks like this
https://accounts.google.com/AccountChooser?continue=https://accounts.google.com/o/oauth2/auth?
scope=https://www.googleapis.com/auth/userinfo.email+https://www.googleapis.com/auth/cloudprint+https://www.googleapis.com/auth/userinfo.profile+openid
&response_type=token+code+id_token+gsession
&redirect_uri=http://localhost:8080/identity/control/authenticate
&state=AFD_5tmV........... etc
&client_id=143312559437-4o93ranlfalg78rj006qirib182bnkj4.apps.googleusercontent.com
&include_profile=true
&hl=en-GB
&from_login=1
&as=77237587f41849c5
<mpl=popup
&btmpl=authsub
&hl=en_GB
&scc=1
&oauth=1
Why and how is access_type=offline removed ?