After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 750746 - Cold start OAuth2 authorization
Cold start OAuth2 authorization
Status: RESOLVED FIXED
Product: libgdata
Classification: Platform
Component: General
git master
Other Linux
: Normal enhancement
: ---
Assigned To: libgdata-maint
libgdata-maint
Depends on:
Blocks:
 
 
Reported: 2015-06-10 21:55 UTC by Holger Berndt
Modified: 2015-06-21 22:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Add GDataOAuth2Authorizer:refresh-token API (10.17 KB, patch)
2015-06-14 14:53 UTC, Philip Withnall
committed Details | Review

Description Holger Berndt 2015-06-10 21:55:08 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.
Comment 1 Philip Withnall 2015-06-14 14:53:33 UTC
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.
Comment 2 Philip Withnall 2015-06-14 14:56:48 UTC
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()
Comment 3 Holger Berndt 2015-06-14 19:42:05 UTC
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?)
Comment 4 Philip Withnall 2015-06-16 16:20:54 UTC
(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).
Comment 5 Philip Withnall 2015-06-16 16:22:48 UTC
Attachment 305241 [details] pushed as b80f888 - core: Add GDataOAuth2Authorizer:refresh-token API
Comment 6 Holger Berndt 2015-06-17 22:32:13 UTC
After making m4-common from jhbuild bootstrap available, I can confirm that git master also works for me.

Thanks!
Comment 7 Philip Withnall 2015-06-19 07:45:29 UTC
(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.
Comment 8 Holger Berndt 2015-06-19 22:49:51 UTC
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.
Comment 9 Philip Withnall 2015-06-21 22:16:15 UTC
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!