Type alias JWTAuthDefinitionInput<Cred>
JWTAuthDefinitionInput <Cred>: {
getCredentialFromJWT: ((ctx) => Cred | Promise<Cred>);
getCredentialOption: GetCredentialOptionFn<Cred>;
refreshTokens?: ((ctx) => Promise<Cred["data"]>);
singleCredentialOnly?: boolean;
}
getCredentialFromJWT: ((ctx) => Cred | Promise<Cred>);
getCredentialOption: GetCredentialOptionFn<Cred>;
refreshTokens?: ((ctx) => Promise<Cred["data"]>);
singleCredentialOnly?: boolean;
}
Type Parameters
Cred extends AnyAppCredential
Type declaration
get
Credential : ((ctx) => Cred | Promise<Cred>)FromJWT - (ctx): Cred | Promise<Cred>
Returns Cred | Promise<Cred>
get
Credential : GetCredentialOptionFn<Cred>Option Receives a Credential and should return the avatar and label for this credential. It's called every time a credential is rendered in UI.
Optional
refreshTokens ?: ((ctx) => Promise<Cred["data"]>)- (ctx): Promise<Cred["data"]>
Called every time Rollout is about to use a credential and can be used to refresh the credential, if needed. Receives the stored credential and should return a valid credential, whether it's the received one, or a fresh one.
Returns Promise<Cred["data"]>
Optional
singleCredential ?: booleanOnly If true, it's assumed there will be always one credential only at most, therefore UI for selecting credential won't not rendered.
Default
false
Called on every incoming Consumer request. Receives the
authData
from the consumer JWT token and should return the credential to be stored.