google-drive-ruby icon indicating copy to clipboard operation
google-drive-ruby copied to clipboard

Deprecated OAuth out-of-band (oob) flow

Open fadeltd opened this issue 2 years ago • 3 comments

OAuth out-of-band (oob) flow will be deprecated

https://developers.googleblog.com/2022/02/making-oauth-flows-safer.html

https://github.com/gimite/google-drive-ruby/blob/55b996b2c287cb0932824bf2474248a498469328/lib/google_drive/session.rb#L158

New OAuth usage will be blocked for the OOB flow

image

Can we migrate to an alternative flow? https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback

fadeltd avatar May 25 '22 05:05 fadeltd

Hi, i think the error redirect url not valid, i have same issue with you and i solved the issue.

maybe the step link this

  1. you create new routes for get callback response from google, maybe like this get 'google_drive_response', to: 'public_page#google_drive_response'
  2. you register url on google console image
  3. change redirect url change to routes callback response, for example like this redirect_uri: "http://localhost:3000/google_drive_response/"

i hope you issue is solved, because me solved the issue:))

septianmalela avatar Aug 05 '22 09:08 septianmalela

Also waiting for a proper solution on this. @gimite ?

koos avatar Aug 07 '23 20:08 koos

Wouldn't it be a solution to replace:

https://github.com/gimite/google-drive-ruby/blob/55b996b2c287cb0932824bf2474248a498469328/lib/google_drive/session.rb#L158C1-L159C1

with

redirect_uri: config.redirect_uri

and just pass a 'dummy' redirect_uri in your method? Something like this:

require 'google_drive'

require 'google_drive'

class GoogleDriveService

  attr_accessor :client_id, :client_secret, :redirect_uri, :refesh_token, :scope, :save, :scope, :refresh_token

  def initialize(client_id, client_secret, redirect_uri)
    @client_id = client_id
    @client_secret = client_secret
    @redirect_uri = redirect_uri
  end
  
  def create_session
    session = GoogleDrive::Session.from_config(self)
  end

end```

koos avatar Aug 07 '23 20:08 koos