Standard Authentication
This section covers the standard authentication operations available in the GraphQL CRM API.
Queries​
currentUser​
Get the currently authenticated user's information based on their role.
query CurrentUser {
currentUser {
id
email
displayName
phoneNumber
jobTitle
bio
avatarUrl
roles
createdAt
updatedAt
}
}
Returns:
- CrmUserModel: The current authenticated user's details
Example Input:
query {
currentUser {
id
email
displayName
roles
}
}
Example Output:
{
"data": {
"currentUser": {
"id": "admin_12345abcde",
"email": "admin@blockbet.com",
"displayName": "Admin User",
"roles": ["CMS", "BO"]
}
}
}
Mutations​
requestLookup​
Initiate a login process for an admin. This will send a verification code to the admin's email.
mutation RequestLookup($input: RequestLookupInput!) {
requestLookup(input: $input) {
status
errorMessage
email
nextRequestAt
authUrlFor2fa
unlocksAt
}
}
Input:
input RequestLookupInput {
email: String!
recaptcha: String!
}
Returns:
type RequestLookupResponse {
status: Boolean!
errorMessage: String
email: String!
nextRequestAt: Int!
authUrlFor2fa: String
unlocksAt: Date
}
Example Input:
mutation {
requestLookup(
input: { email: "admin@blockbet.com", recaptcha: "03AGdBq24tJhg..." }
) {
status
errorMessage
email
nextRequestAt
authUrlFor2fa
}
}
Example Output:
{
"data": {
"requestLookup": {
"status": true,
"errorMessage": null,
"email": "admin@blockbet.com",
"nextRequestAt": 120,
"authUrlFor2fa": null
}
}
}
verifyLookup​
Verify the email code sent during the login process.
mutation VerifyLookup($input: VerifyLookupInput!) {
verifyLookup(input: $input) {
status
errorMessage
unlocksAt
remainingAttempts
}
}
Input:
input VerifyLookupInput {
code: String!
}
Returns:
type VerificationResponse {
status: Boolean!
errorMessage: String
unlocksAt: Date
remainingAttempts: Int
}
Example Input:
mutation {
verifyLookup(input: { code: "123456" }) {
status
errorMessage
remainingAttempts
}
}
Example Output:
{
"data": {
"verifyLookup": {
"status": true,
"errorMessage": null,
"remainingAttempts": null
}
}
}
verify2fa​
Complete the login process by verifying the 2FA code.
mutation Verify2fa($input: Verify2faInput!) {
verify2fa(input: $input) {
status
errorMessage
unlocksAt
remainingAttempts
}
}
Input:
input Verify2faInput {
codeFor2fa: String!
}
Returns:
type VerificationResponse {
status: Boolean!
errorMessage: String
unlocksAt: Date
remainingAttempts: Int
}
Example Input:
mutation {
verify2fa(input: { codeFor2fa: "123456" }) {
status
errorMessage
remainingAttempts
}
}
Example Output:
{
"data": {
"verify2fa": {
"status": true,
"errorMessage": null,
"remainingAttempts": null
}
}
}
signOut​
Log out the current administrative user.
mutation SignOut {
signOut
}
Returns:
- Boolean:
true
if successful,false
otherwise
Example Input:
mutation {
signOut
}
Example Output:
{
"data": {
"signOut": true
}
}