renewCredentials method
Uses a refreshToken
to get a new access token.
Endpoint
https://auth0.com/docs/api/authentication#refresh-token
Notes
- Refresh tokens can be retrieved by specifying the
offline_access
scope during authentication. scopes
can be specified if a reduced set of scopes is desired.
Further reading
Usage example
final result = await auth0.api.login({
usernameOrEmail: 'my@email.com',
password: 'my_password'
connectionOrRealm: 'Username-Password-Authentication',
scopes: {'openid', 'profile', 'email', 'phone', 'offline_access'}
});
if (result.refreshToken != null) {
await auth0.api.renewCredentials(refreshToken: result.refreshToken!);
}
Implementation
Future<Credentials> renewCredentials({
required final String refreshToken,
final Set<String> scopes = const {},
final Map<String, String> parameters = const {},
}) =>
Auth0FlutterAuthPlatform.instance.renew(_createApiRequest(
AuthRenewOptions(
refreshToken: refreshToken,
scopes: scopes,
parameters: parameters)));