googleAuth
Public: no authentication required.
Signs in with a Google ID token. When no user matches the Google account it returns signupRequired and the Google profile instead of signing in. Customer accounts are refused, and so are accounts without admin-console access when called from the console. A required second factor cannot be skipped. On success it returns tokens and a session token and sets sign-in cookies for web clients. No sign-in needed.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation GoogleAuth($token: String!) {
googleAuth(token: $token) {
accessToken
authenticated
refreshToken
sessionToken
signupRequired
pendingUser {
name
avatar
email
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation GoogleAuth($token: String!) {\n googleAuth(token: $token) {\n accessToken\n authenticated\n refreshToken\n sessionToken\n signupRequired\n pendingUser {\n name\n avatar\n email\n }\n }\n}",
"variables": {
"token": "string"
}
}
EOF
Variables:
{
"token": "string"
}
Response:
{
"data": {
"googleAuth": {
"accessToken": "string",
"authenticated": true,
"refreshToken": "string",
"sessionToken": "string",
"signupRequired": true,
"pendingUser": {
"name": "string",
"avatar": "string",
"email": "string"
}
}
}
}
googleAuth(
token: String!
): GoogleAuthResponse!
Arguments
googleAuth.token ● String! non-null scalar
The Google ID token returned by Google sign-in.
Type
GoogleAuthResponse object
The result of signing in with Google.