GNOME Bugzilla – Bug 750746
Cold start OAuth2 authorization
Last modified: 2015-06-21 22:16:15 UTC
GDataOAuth2Authorizer should support cold start (authorization without user interaction). This could be done by providing access to the refresh token, so that the application can store it on shutdown, and a request_authorization() interface which takes the refresh token instead of the authorization code.
Created attachment 305241 [details] [review] core: Add GDataOAuth2Authorizer:refresh-token API Add new API to allow the refresh token from an OAuth 2 authorizer to be stored by an application and restored into a new GDataOAuth2Authorizer instance (a cold start). This adds the following new API: • GDataOAuth2Authorizer:refresh-token • gdata_oauth2_authorizer_dup_refresh_token() • gdata_oauth2_authorizer_set_refresh_token() It does not add any new tests.
Holger, can you please try the attached patch with libgdata and see if that works for you? I have not had a chance to test it. I am interested in feedback on the API as well as functionality. The general idea is that you should authenticate with GDataOAuth2Authorizer instance auth1, then save the value of saved_token = gdata_oauth2_authorizer_dup_refresh_token(auth1) On a cold start, call auth2 = gdata_oauth2_authorizer_new() /* as normal */ gdata_oauth2_authorizer_set_refresh_token(auth2, saved_token) gdata_authorizer_refresh_authorization_async()
Awesome. Thanks Philip. I applied your patch on top of LIBGDATA_0_17_1, and I can confirm that saving the refresh-token and using it in a following cold-start worked well for me. I initially tried git master, but had problems during the configure-step with the two seemingly new autotools macros AX_IS_RELEASE([git-directory]) and AX_COMPILER_FLAGS so I couldn't confirm unpatched git-master (any hint of how to resolve that?)
(In reply to Holger Berndt from comment #3) > Awesome. Thanks Philip. I applied your patch on top of LIBGDATA_0_17_1, and > I can confirm that saving the refresh-token and using it in a following > cold-start worked well for me. Great, I’ll commit it shortly. Thanks for testing. > I initially tried git master, but had problems during the configure-step > with the two seemingly new autotools macros > > AX_IS_RELEASE([git-directory]) > > and > > AX_COMPILER_FLAGS > > so I couldn't confirm unpatched git-master (any hint of how to resolve that?) You need to have autoconf-archive installed; or use JHBuild which will automatically install the necessary macros (using m4-common).
Attachment 305241 [details] pushed as b80f888 - core: Add GDataOAuth2Authorizer:refresh-token API
After making m4-common from jhbuild bootstrap available, I can confirm that git master also works for me. Thanks!
(In reply to Holger Berndt from comment #6) > After making m4-common from jhbuild bootstrap available, I can confirm that > git master also works for me. > > Thanks! Brilliant. Please do file more bugs if you find more problems. I always worry that people are using libgdata, finding bugs, and then giving up.
Will do. Is there a release planned anytime soon? The enhancement from this report is critical for me, since having to re-auth interactively on every program start is quite annoying and does not make up for a good user experience.
There will definitely be a 0.18.0 stable release ready for GNOME 3.16 (so before September). I will try and make another 0.17.x release before then, but I can’t guarantee it!