loginWithPassword method
Login with username and password
Only allowed for Flow.password flows.
Implementation
Future<Credential> loginWithPassword(
{required String username, required String password}) async {
if (type != FlowType.password) {
throw UnsupportedError('Flow is not password');
}
var json = await http.post(client.issuer.tokenEndpoint,
body: {
'grant_type': 'password',
'username': username,
'password': password,
'scope': scopes.join(' '),
'client_id': client.clientId,
},
client: client.httpClient);
return Credential._(client, TokenResponse.fromJson(json), null);
}