createSessionTokenFromTemplate method
Future<CreateSessionToken200Response?>
createSessionTokenFromTemplate(
- String sessionId,
- String templateName, {
- CreateSessionTokenFromTemplateRequest? createSessionTokenFromTemplateRequest,
Create a session token from a jwt template
Creates a JSON Web Token(JWT) based on a session and a JWT Template name defined for your instance
Parameters:
-
String sessionId (required): The ID of the session
-
String templateName (required): The name of the JWT Template defined in your instance (e.g.
custom_hasura
). -
CreateSessionTokenFromTemplateRequest createSessionTokenFromTemplateRequest:
Implementation
Future<CreateSessionToken200Response?> createSessionTokenFromTemplate(
String sessionId,
String templateName, {
CreateSessionTokenFromTemplateRequest?
createSessionTokenFromTemplateRequest,
}) async {
final response = await createSessionTokenFromTemplateWithHttpInfo(
sessionId,
templateName,
createSessionTokenFromTemplateRequest:
createSessionTokenFromTemplateRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'CreateSessionToken200Response',
) as CreateSessionToken200Response;
}
return null;
}