How do I get offline access (so users don't have to log-in again)

18 views
Skip to first unread message

Qasim Qureshi

unread,
Apr 23, 2017, 1:44:53 AM4/23/17
to Google API Client for Ruby
Hola!

I'm trying to get "offline access" so users don't have to log-in again everytime their session expires. 

Reading the documentation, it seems that the thing I need is access_type=offline. Here's my code:

      client_secrets = Google::APIClient::ClientSecrets.load(
        File.join(
          Rails.root,
          'config',
          'client_secrets.json')
        )
      auth_client = client_secrets.to_authorization
      auth_client.update!(
        :scope => 'https://www.googleapis.com/auth/calendar.readonly',
        :redirect_uri => 'http://localhost:3000/api/calendar_accounts/callback',
        :additional_parameters => {
          "access_type" => "offline",
          "include_granted_scopes" => "true"
          }
        )
      redirect_to auth_client.authorization_uri.to_s


From this bit from the docs: https://developers.google.com/identity/protocols/OAuth2WebServer#offline . But my problem is, this *still* doesn't ask the user for offline-access permissions. I'm stumped!
Reply all
Reply to author
Forward
0 new messages