Confirm 2FA Setting
The confirmRequest2FA
mutation is used to confirm the setup of two-factor authentication (2FA) for a user account. This step verifies that the 2FA method selected by the user is properly configured.
Mutation: confirmRequest2FA
Schema:
confirmRequest2FA(
email: String!,
method: String!,
code: String!
): String!
Parameters
email
(String): The user's email address to confirm 2FA. This field is mandatory.method
(String): The 2FA method to be confirmed. This field is mandatory and can be:"app"
: Google Authentication app."email"
: Email code."phone"
: SMS code.
code
(String): The verification code from the Google App, Email, or SMS. This field is mandatory.
Return
The mutation returns a string indicating the result of the 2FA confirmation attempt. The possible return values are:
"Success"
: Indicates that the 2FA setup has been successfully confirmed."Failed"
: Indicates that the confirmation code is incorrect or expired.
Exception: Indicates an error in the confirmation process with specific messages:
"Cannot find user by + ${email}"
: The email address is not registered in the system."Your account is not verified"
: The account is not verified and thus cannot complete 2FA setup."There is no proper 2FA setting"
: The 2FA setup is not properly configured.
Example Mutation
The following is an example of how to use the confirmRequest2FA
mutation to confirm a 2FA setting:
mutation {
confirmRequest2FA(
email: "demouser@nyyu.io",
method: "email",
code: "550880"
)
}
In this example, the mutation attempts to confirm the 2FA setup for the user with the email address demouser@nyyu.io
using the email method with the code 550880
. The return value will indicate whether the confirmation was successful or if there was an error such as an incorrect code or unregistered email.