TokenCredential Class
Represents a token credential that is used to authorize HTTPS requests. The token can be updated by the user.
- Inheritance
-
builtins.objectTokenCredential
Constructor
TokenCredential(initial_value=None)
Parameters
- initial_value
Variables
- token
- str
The authorization token. It can be set by the user at any point in a thread-safe way.
Methods
| signed_session |
Sign requests session with the token. This method is called every time a request is going on the wire. The user is responsible for updating the token with the preferred tool/SDK. In general there are two options:
The second option is recommended as it tends to be more performance-friendly. |
| token |
signed_session
Sign requests session with the token. This method is called every time a request is going on the wire. The user is responsible for updating the token with the preferred tool/SDK. In general there are two options:
override this method to update the token in a preferred way and set Authorization header on session
not override this method, and have a timer that triggers periodically to update the token on this class
The second option is recommended as it tends to be more performance-friendly.
signed_session(session=None)
Parameters
- session
- <xref:requests.Session>
The session to configure for authentication
Return type
token
token(new_value)
Parameters
- new_value
new value to be set as the token.
Feedback
Submit and view feedback for