Skip to main content

Type Alias: GetToken

GetToken = () => Promise<Nullable<string>>

Retrieves the authentication token for the current user session. This token can be used for authenticated API requests.

This method will only succeed if the user is currently authenticated.

Returns​

Promise<Nullable<string>>

A promise resolving to the JWT token string or null if no user is authenticated

Example​

window.mimeeqAuth.authorization.getToken()
.then(token => {
if (token) {
// Use the token for authenticated API requests
fetch('https://api.example.com/data', {
headers: {
'Authorization': `Bearer ${token}`
}
});
} else {
console.log('No authenticated user found');
}
});