Class: DropboxOAuth2FlowNoRedirect

Inherits:
DropboxOAuth2FlowBase show all
Defined in:
lib/dropbox_sdk.rb

Overview

OAuth 2 authorization helper for apps that can’t provide a redirect URI (such as the command line example apps).

Instance Method Summary collapse

Methods inherited from DropboxOAuth2FlowBase

#_finish, #_get_authorize_url

Constructor Details

#initialize(consumer_key, consumer_secret, locale = nil) ⇒ DropboxOAuth2FlowNoRedirect

  • consumer_key: Your Dropbox API app’s “app key”

  • consumer_secret: Your Dropbox API app’s “app secret”

  • locale: The locale of the user currently using your app.



502
503
504
# File 'lib/dropbox_sdk.rb', line 502

def initialize(consumer_key, consumer_secret, locale=nil)
  super(consumer_key, consumer_secret, locale)
end

Instance Method Details

#finish(code) ⇒ Object

If the user approves your app, they will be presented with an “authorization code”. Have the user copy/paste that authorization code into your app and then call this method to get an access token.

Returns a two-entry list (access_token, user_id)

  • access_token is an access token string that can be passed to DropboxClient.

  • user_id is the Dropbox user ID of the user that just approved your app.



519
520
521
# File 'lib/dropbox_sdk.rb', line 519

def finish(code)
  _finish(code, nil)
end

#startObject

Returns a authorization_url, which is a page on Dropbox’s website. Have the user visit this URL and approve your app.



508
509
510
# File 'lib/dropbox_sdk.rb', line 508

def start()
  _get_authorize_url(nil, nil)
end