| Class | FaradayMiddleware::OAuth2 |
| In: |
lib/faraday_middleware/request/oauth2.rb
|
| Parent: | Faraday::Middleware |
Public: A simple middleware that adds an access token to each request.
By default, the token is added as both "access_token" query parameter and the "Authorization" HTTP request header. It can alternatively be added exclusively as a bearer token "Authorization" header by specifying a "token_type" option of "bearer". However, an explicit "access_token" parameter or "Authorization" header for the current request are not overriden.
Examples
# configure default token: OAuth2.new(app, 'abc123') # configure query parameter name: OAuth2.new(app, 'abc123', :param_name => 'my_oauth_token') # use bearer token authorization header only OAuth2.new(app, 'abc123', :token_type => 'bearer') # default token value is optional: OAuth2.new(app, :param_name => 'my_oauth_token')
| PARAM_NAME | = | 'access_token'.freeze |
| TOKEN_TYPE | = | 'param'.freeze |
| AUTH_HEADER | = | 'Authorization'.freeze |
| param_name | [R] | |
| token_type | [R] |