lib/intuit-oauth/migration.rb
# Exchange an OAuth 1 token for an OAuth 2 token pair. It is used for apps that are using OAuth 1.0 and want to migrate
# to OAuth 2.0.
#
# @param [cusomer_key] the OAuth 1.0 Consumer key
# @param [consumer_secret] the OAuth 1.0 Consumer Secret
# @param [access_token] the OAuth 1.0 Access Token
# @param [access_secret] the OAuth 1.0 Access Token Secret
# @param [scopes] the scopes for the token.
# @return [OAuth2Token] the OAuth2 Token object
Exchange an OAuth 1 token for an OAuth 2 token pair. It is used for apps that are using OAuth 1.0 and want to migrate
to OAuth 2.0.
Exchange an OAuth 1 token for an OAuth 2 token pair . It is used for apps that are using OAuth 1 . 0 and want to migrate to OAuth 2 . 0 .
def migrate_tokens(consumer_key, consumer_secret, access_token, access_secret, scopes)
        if %w[production prod].include? @client.environment.downcase
          migration_endpoint = IntuitOAuth::Config::MIGRATION_URL_PROD
        else
          migration_endpoint = IntuitOAuth::Config::MIGRATION_URL_SANDBOX
        end
        oauth1_tokens = {
          consumer_key: consumer_key,
          consumer_secret: consumer_secret,
          access_token: access_token,
          access_secret: access_secret
        }
        oauth1_header = IntuitOAuth::Utils.get_oauth1_header('POST', migration_endpoint, oauth1_tokens)
        headers = {
          'Content-Type': 'application/json',
          Accept: 'application/json',
          Authorization: oauth1_header
        }
        body = {
          scope: IntuitOAuth::Utils.scopes_to_string(scopes),
          redirect_uri: @client.redirect_uri,
          client_id: @client.id,
          client_secret: @client.secret
        }
        IntuitOAuth::Transport.request('POST', migration_endpoint, headers, body.to_json)
      end
def migrate_tokens ( consumer_key , consumer_secret , access_token , access_secret , scopes ) if %w[ production prod ] . include? @client . environment . downcase migration_endpoint = IntuitOAuth :: Config :: MIGRATION_URL_PROD else migration_endpoint = IntuitOAuth :: Config :: MIGRATION_URL_SANDBOX end oauth1_tokens = { consumer_key : consumer_key , consumer_secret : consumer_secret , access_token : access_token , access_secret : access_secret } oauth1_header = IntuitOAuth :: Utils . get_oauth1_header ( 'POST' , migration_endpoint , oauth1_tokens ) headers = { 'Content-Type' : 'application/json' , Accept : 'application/json' , Authorization : oauth1_header } body = { scope : IntuitOAuth :: Utils . scopes_to_string ( scopes ) , redirect_uri : @client . redirect_uri , client_id : @client . id , client_secret : @client . secret } IntuitOAuth :: Transport . request ( 'POST' , migration_endpoint , headers , body . to_json ) end
Exchange an OAuth 1 token for an OAuth 2 token pair.
Exchange an OAuth 1 token for an OAuth 2 token pair .
the OAuth2 Token object
the OAuth2 Token object
OAuth2Token
consumer_key
<not_specific>
consumer_secret
<not_specific>
access_token
<not_specific>
access_secret
<not_specific>
scopes
<not_specific>
<not_specific>
the scopes for the token.
the scopes for the token .