Method CreateSubtoken
- Namespace
- GuildWars2.Authorization
- Assembly
- GuildWars2.dll
CreateSubtoken(string, Action<SubtokenOptionsBuilder>, MissingMemberBehavior, CancellationToken)
Creates a new access token with the specified permissions, expiration and URL restrictions. If the parent token is an API key, the subtoken will inherit the permissions of the API key. The subtoken will always have an expiration date and optionally more restricted permissions. If the parent token is also a subtoken, the new subtoken will inherit the restrictions of the old subtoken.
public Task<(CreatedSubtoken Value, MessageContext Context)> CreateSubtoken(string accessToken, Action<SubtokenOptionsBuilder> configureCallback, MissingMemberBehavior missingMemberBehavior = MissingMemberBehavior.Error, CancellationToken cancellationToken = default)
Parameters
accessTokenstringAn API key or subtoken. If it is a subtoken, it must have permission to use /v2/createsubtoken.
configureCallbackAction<SubtokenOptionsBuilder>Configures the options used during subtoken creation.
missingMemberBehaviorMissingMemberBehaviorThe desired behavior when JSON contains unexpected members.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<(CreatedSubtoken Value, MessageContext Context)>
A task that represents the API request.
Remarks
A subtoken expires immediately when the API key it was created from is deleted.