class Asana::Authentication::OAuth2::BearerTokenAuthentication

Public: A mechanism to authenticate with an OAuth2 bearer token obtained somewhere, for instance through omniauth-asana.

Note: This authentication mechanism doesn’t support token refreshing. If you’d like refreshing and you have a refresh token as well as a bearer token, you can generate a proper access token with {AccessTokenAuthentication.from_refresh_token}.

Public Class Methods

new(bearer_token) click to toggle source

Public: Initializes a new BearerTokenAuthentication with a plain bearer token.

bearer_token - [String] a plain bearer token.

# File lib/asana/authentication/oauth2/bearer_token_authentication.rb, line 16
def initialize(bearer_token)
  @token = bearer_token
end

Public Instance Methods

configure(connection) click to toggle source

Public: Configures a Faraday connection injecting its token as an OAuth2 bearer token.

connection - [Faraday::Connection] the Faraday connection instance.

Returns nothing.

# File lib/asana/authentication/oauth2/bearer_token_authentication.rb, line 26
def configure(connection)
  connection.request :oauth2, @token
end