Class: TeamBattlesSdk::StaticKeyAccessTokenProvider
- Inherits:
-
Object
- Object
- TeamBattlesSdk::StaticKeyAccessTokenProvider
- Includes:
- MicrosoftKiotaAbstractions::AccessTokenProvider
- Defined in:
- lib/teambattles_sdk/client.rb
Overview
Returns the raw API key as the bearer token. The base bearer provider prepends “Bearer ”, matching the server’s expected ‘Authorization: Bearer tb_<key>` header.
kiota-ruby’s BaseBearerTokenAuthenticationProvider calls ‘get_authorization_token(…).resume` on the provider, so the method must return a Fiber that yields the raw key (not the key string itself). The allowed-hosts validator is exposed through the `host_validator` accessor declared by the AccessTokenProvider mixin.
Instance Method Summary collapse
- #get_authorization_token(_uri, _additional_authentication_context = {}) ⇒ Object
-
#initialize(api_key, host) ⇒ StaticKeyAccessTokenProvider
constructor
A new instance of StaticKeyAccessTokenProvider.
Constructor Details
#initialize(api_key, host) ⇒ StaticKeyAccessTokenProvider
Returns a new instance of StaticKeyAccessTokenProvider.
29 30 31 32 |
# File 'lib/teambattles_sdk/client.rb', line 29 def initialize(api_key, host) @api_key = api_key @host_validator = MicrosoftKiotaAbstractions::AllowedHostsValidator.new([host]) end |
Instance Method Details
#get_authorization_token(_uri, _additional_authentication_context = {}) ⇒ Object
34 35 36 37 |
# File 'lib/teambattles_sdk/client.rb', line 34 def (_uri, _additional_authentication_context = {}) key = @api_key Fiber.new { key } end |