> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/coda-webstore/user-login/custom-login.md).

# Custom Login

If you have your own login system, Coda allows you to easily integrate it into your web store. Our setup follows the industry-standard OAuth 2.0 protocol, so integration is simple.

## When should you use Custom Login?

You have your own proprietary login system that your users are familiar with. Offering the same login method (and hence, user credentials) instils a sense of trust and reduces friction when your users visit the web store.

## Integration details

* You must provide OAuth 2.0 endpoints: `/authorize`, `/token`, `/userinfo`
* Your Web Store’s URL must be allowlisted in your OAuth configuration
* The user profile data you send us should include: `user_id` (mandatory), `email`, `display_name` (or) `nickname`&#x20;
* All communication must use HTTPS, and it is recommended to follow OAuth 2.0 best practices

## Custom Login Authentication flow

### 1. User lands on the Web Store

The user visits the web store (for example, <https://store.example.com>). A Sign In call-to-action (CTA) is visible in the UI.

### 2. User Initiates Sign In

When the user clicks on the Sign In CTA, the web store redirects the user to the game publisher's OAuth login endpoint, typically using: `https://auth.publisher.com/authorize?client_id=...&redirect_uri=...&response_type=code&scope=...`

### 3. User Authenticates with Game Publisher

The user enters their existing login credentials. Upon successful authentication, the publisher redirects the user back to the web store with an authorisation code. Sample: `https://store.example.com/callback?code=AUTH_CODE`

### 4. Web Store exchanges AUTH\_CODE for a Token

The web store receives the AUTH\_CODE and sends a token request to the publisher's token endpoint: `POST https://auth.publisher.com/token`

In response, the web store receives tokens - an access token and an optional refresh token - as well as optional user details such as email, nickname, etc.

You can also request for the token to be sent again to your backend for verification before sharing the above-mentioned user details.

### 5. Create or Update Web Store Account

The web store creates a new user record in its database (or updates an existing one, if available) using the data received. This links the game publisher's identity with a web store account and allows the user to appear logged in on the web store.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.coda.co/coda-webstore/user-login/custom-login.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
