signIn method
- required MyUserCredentials credentials,
- required MyUserIdentifier identifier,
Creates a new Session for the MyUser identified by the provided MyUserIdentifier.
Represents a sign-in action.
AccessToken of the created Session may be prolonged via refreshSession.
If the provided MyUserIdentifier.email address (or MyUserIdentifier.phone number) is not occupied by any existing MyUser yet, then, along with provided MyUserCredentials.code, creates a new MyUser with the authenticated UserEmail address (or UserPhone number) being assigned to him. This means, that there is no difference between sign-in and sign-up actions in this mutation when a UserEmail address (or UserPhone number) is used in combination with a ConfirmationCode.
User-Agent HTTP header must be specified for this mutation and meet the
UserAgent scalar format.
Authentication
None.
Non-idempotent
Each time creates a new Session.
Additionally, always uses the provided ConfirmationCode, disallowing to use it again.
Implementation
Future<SignIn$Mutation$CreateSession$CreateSessionOk> signIn({
required MyUserCredentials credentials,
required MyUserIdentifier identifier,
}) async {
Log.debug(
'signIn(identifier: ${identifier.obscured}, credentials: ${credentials.obscured})',
'$runtimeType',
);
final variables = SignInArguments(
credentials: credentials,
ident: identifier,
);
final QueryResult result = await client.mutate(
MutationOptions(
operationName: 'SignIn',
document: SignInMutation(variables: variables).document,
variables: variables.toJson(),
),
onException: (data) => CreateSessionException(
(SignIn$Mutation.fromJson(data).createSession
as SignIn$Mutation$CreateSession$CreateSessionError)
.code,
),
raw: const RawClientOptions(),
);
return SignIn$Mutation.fromJson(result.data!).createSession
as SignIn$Mutation$CreateSession$CreateSessionOk;
}