app/controllers/googledrive_controller.rb
# handle the callback from Google (it will respond to the above call) and grab the authorisation code
handle the callback from Google (it will respond to the above call) and grab the authorisation code
handle the callback from Google ( it will respond to the above call ) and grab the authorisation code
def oauth2callback
    client = oauth2client
    if params[:code]
      client.update!(code: params[:code])
      response = client.fetch_access_token!
      session[:refresh_token] = response['refresh_token']
    end
    redirect_to finish_googledrive_index_url
  end
def oauth2callback client = oauth2client if params [ :code ] client . update! ( code : params [ :code ] ) response = client . fetch_access_token! session [ :refresh_token ] = response [ 'refresh_token' ] end redirect_to finish_googledrive_index_url end
handle the callback from Google (it will respond to the above call) and grab the authorisation code
handle the callback from Google ( it will respond to the above call ) and grab the authorisation code
# update the oauth2 client with the authorisation code that Google just gave us # get the access and refresh tokens # persist the refresh tokens - it can be used to obtain access_tokens in future