> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/users/module-1/authentication.md). Agents can also search and read this documentation through its [MCP server](https://apidocs.akinon.com/~gitbook/mcp).

# Authentication

Authentication, registration, and password flows

## Complete Google login with an access token

> Exchanges a Google OAuth access token for an OmniShop user session.\
> \
> \*\*Process\*\*\
> \- Validates the token via Google token-info endpoint\
> \- Confirms token audience matches configured client IDs\
> \- Fetches user info and completes social login\
> \- Fills in the user's empty phone number from the Google profile when \`GOOGLE\_SCOPE\`\
> &#x20; includes \`<https://www.googleapis.com/auth/user.phonenumbers.read\\`>; the access token\
> &#x20; must carry that scope as well\
> \
> \*\*Redirects\*\*\
> \- Success: redirects to the basket or provided \`next\` parameter\
> \- Failure: returns HTTP 400

```json
{"openapi":"3.1.0","info":{"title":"Users API - Public Endpoints","version":"1.0.0"},"tags":[{"name":"Authentication","description":"Authentication, registration, and password flows"}],"servers":[{"description":"Default commerce site","url":"https://{commerce_url}","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Commerce storefront hostname"}}},{"description":"Local development","url":"http://localhost:8000"}],"paths":{"/google/login/token/":{"post":{"tags":["Authentication"],"operationId":"loginWithGoogleToken","summary":"Complete Google login with an access token","description":"Exchanges a Google OAuth access token for an OmniShop user session.\n\n**Process**\n- Validates the token via Google token-info endpoint\n- Confirms token audience matches configured client IDs\n- Fetches user info and completes social login\n- Fills in the user's empty phone number from the Google profile when `GOOGLE_SCOPE`\n  includes `https://www.googleapis.com/auth/user.phonenumbers.read`; the access token\n  must carry that scope as well\n\n**Redirects**\n- Success: redirects to the basket or provided `next` parameter\n- Failure: returns HTTP 400","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleLoginTokenRequest"}}}},"responses":{"302":{"description":"Login succeeded, user redirected","headers":{"Location":{"schema":{"type":"string"},"description":"Destination URL (defaults to `/baskets/basket/`)"}}},"400":{"description":"Token invalid or Google verification failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}},"components":{"schemas":{"GoogleLoginTokenRequest":{"type":"object","description":"JSON payload forwarded to Google token verifier","required":["access_token"],"properties":{"access_token":{"type":"string","description":"OAuth access token issued by Google"}}},"ErrorResponse":{"type":"object","description":"Generic error payload","required":["detail"],"properties":{"detail":{"type":"string"},"code":{"type":"string"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/commerce-openapis/users/module-1/authentication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
