---
title: How sign-in works
project: OpenAuth
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/openauth/1-0/reference/how-sign-in-works/
updated: 2026-11-19T09:22:04.896Z
---

# How sign-in works

> The full round trip between your app, OpenAuth and the provider, step by step.

Your app talks to OpenAuth over HTTP with an [app token](../../guides/app-tokens/). The user's browser goes from your app to OpenAuth, on to the provider, and back. In the examples, OpenAuth runs at `https://auth.example.com` and your app at `https://www.example.com`.

## The steps

**1.** Your app makes up a session ID (any unique text, for example a UUID) and [starts a sign-in](../start-sign-in/):

```http
POST https://auth.example.com/
x-token: YOUR_APP_TOKEN
Content-Type: application/json

{"serviceid":"facebook","sessionid":"7f3a9c21","url":"https://www.example.com/auth/"}
```

**2.** OpenAuth answers with a sign-in address:

```json
"https://auth.example.com/login/mwn8jzivbyr19ogt6g/"
```

**3.** Your app redirects the user's browser to that address. OpenAuth redirects the browser on to the provider's sign-in page.

**4.** The user signs in at the provider and allows access. The provider sends the browser back to OpenAuth's callback endpoint, `https://auth.example.com/oauth/facebook/`.

**5.** OpenAuth gets the profile from the provider and redirects the browser to your `url`, with your session ID added:

```text
https://www.example.com/auth/?sessionid=7f3a9c21
```

**6.** Your app [reads the profile](../get-profile/):

```http
GET https://auth.example.com/sessions/?id=7f3a9c21
x-token: YOUR_APP_TOKEN
```

## Time limits

The session lives 15 minutes from step 1. The user must finish signing in, and your app must read the profile, within that time. After that, `/login/.../` and `/sessions/` answer `404 Session not found`.

Sessions are kept in memory, so a restart of OpenAuth ends them all.

## Without a return address

If you leave out `url`, step 5 shows the user a page that says they have logged in and can close it. Your app then reads the profile with its session ID as in step 6. See [Start a sign-in](../start-sign-in/).

## Addresses

| Address | Who calls it |
|---|---|
| `POST /` | Your app, with a token. |
| `GET /login/{id}/` | The user's browser. |
| `GET /oauth/{serviceid}/` | The provider, through the user's browser. Register it at the provider. |
| `GET /sessions/` | Your app, with a token. |
