switchAccountType method
- MmSwitchAccountTypeRequest mmSwitchAccountTypeRequest
Switch login method
Switch a user's login method from using email to OAuth2/SAML/LDAP or back to email. When switching to OAuth2/SAML, account switching is not complete until the user follows the returned link and completes any steps on the OAuth2/SAML service provider. To switch from email to OAuth2/SAML, specify current_service
, new_service
, email
and password
. To switch from OAuth2/SAML to email, specify current_service
, new_service
, email
and new_password
. To switch from email to LDAP/AD, specify current_service
, new_service
, email
, password
, ldap_ip
and new_password
(this is the user's LDAP password). To switch from LDAP/AD to email, specify current_service
, new_service
, ldap_ip
, password
(this is the user's LDAP password), email
and new_password
. Additionally, specify mfa_code
when trying to switch an account on LDAP/AD or email that has MFA activated. ##### Permissions No current authentication required except when switching from OAuth2/SAML to email.
Parameters:
- MmSwitchAccountTypeRequest mmSwitchAccountTypeRequest (required):
Implementation
Future<MmSwitchAccountType200Response?> switchAccountType(
MmSwitchAccountTypeRequest mmSwitchAccountTypeRequest,
) async {
final response = await switchAccountTypeWithHttpInfo(
mmSwitchAccountTypeRequest,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw MmApiException(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),
'MmSwitchAccountType200Response',
) as MmSwitchAccountType200Response;
}
return null;
}