ibm-cloud-sdk-core
Version:
Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.
161 lines (73 loc) • 2.36 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [ibm-cloud-sdk-core](./ibm-cloud-sdk-core.md) > [BearerTokenAuthenticator](./ibm-cloud-sdk-core.bearertokenauthenticator.md)
## BearerTokenAuthenticator class
The BearerTokenAuthenticator will set a user-provided bearer token in requests.
The bearer token will be sent as an Authorization header in the form:
Authorization: Bearer <<!-- -->bearer-token<!-- -->>
**Signature:**
```typescript
export declare class BearerTokenAuthenticator extends Authenticator
```
**Extends:** [Authenticator](./ibm-cloud-sdk-core.authenticator.md)
## Constructors
<table><thead><tr><th>
Constructor
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[(constructor)(options)](./ibm-cloud-sdk-core.bearertokenauthenticator._constructor_.md)
</td><td>
</td><td>
Create a new BearerTokenAuthenticator instance.
</td></tr>
</tbody></table>
## Properties
<table><thead><tr><th>
Property
</th><th>
Modifiers
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[requiredOptions](./ibm-cloud-sdk-core.bearertokenauthenticator.requiredoptions.md)
</td><td>
`protected`
</td><td>
string\[\]
</td><td>
</td></tr>
</tbody></table>
## Methods
<table><thead><tr><th>
Method
</th><th>
Modifiers
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
[authenticate(requestOptions)](./ibm-cloud-sdk-core.bearertokenauthenticator.authenticate.md)
</td><td>
</td><td>
Add a bearer token to `requestOptions`<!-- -->. The bearer token information will be set in the Authorization property of "requestOptions.headers" in the form:
Authorization: Bearer <<!-- -->bearer-token<!-- -->>
</td></tr>
<tr><td>
[authenticationType()](./ibm-cloud-sdk-core.bearertokenauthenticator.authenticationtype.md)
</td><td>
</td><td>
Returns the authenticator's type ('bearertoken').
</td></tr>
<tr><td>
[setBearerToken(bearerToken)](./ibm-cloud-sdk-core.bearertokenauthenticator.setbearertoken.md)
</td><td>
</td><td>
Set a new bearer token to be sent in subsequent requests.
</td></tr>
</tbody></table>