Class: Asana::Authentication::OAuth2::BearerTokenAuthentication
- Inherits:
-
Object
- Object
- Asana::Authentication::OAuth2::BearerTokenAuthentication
- Defined in:
- lib/asana/authentication/oauth2/bearer_token_authentication.rb
Overview
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.
A mechanism to authenticate with an OAuth2 bearer token obtained somewhere, for instance through omniauth-asana.
Instance Method Summary collapse
-
#configure(connection) ⇒ void
Configures a Faraday connection injecting its token as an OAuth2 bearer token.
-
#initialize(bearer_token) ⇒ BearerTokenAuthentication
constructor
Initializes a new BearerTokenAuthentication with a plain bearer token.
Constructor Details
#initialize(bearer_token) ⇒ BearerTokenAuthentication
Initializes a new BearerTokenAuthentication with a plain bearer token.
18 19 20 |
# File 'lib/asana/authentication/oauth2/bearer_token_authentication.rb', line 18 def initialize(bearer_token) @token = bearer_token end |
Instance Method Details
#configure(connection) ⇒ void
This method returns an undefined value.
Configures a Faraday connection injecting its token as an OAuth2 bearer token.
28 29 30 |
# File 'lib/asana/authentication/oauth2/bearer_token_authentication.rb', line 28 def configure(connection) connection.request :authorization, 'Bearer', @token end |