Skip to content
getgeolens.com

Exchange Sign In Code

POST
/auth/oauth/exchange/
curl --request POST \
--url https://example.com/auth/oauth/exchange/ \
--header 'Content-Type: application/json' \
--data '{ "code": "example", "nonce": "example" }'

Exchange a single sign-on code for a browser session.

When the SPA shares the API’s origin, an OAuth or SAML callback redirects with a one-time code in the URL fragment instead of setting the refresh cookie. The sign-in page posts that code here, and the response sets the httpOnly refresh cookie and its CSRF cookie the way /auth/login does in cookie mode, with a null refresh_token in the body.

A code is valid once, for two minutes, only from the browser the callback redirected, and only with the nonce the page started the sign-in with. Every refusal is the same 401.

X-GeoLens-Auth-Mode
Any of:
string

Must be cookie: this call only establishes a browser cookie session.

Media type application/json
SsoExchangeRequest
object
code
required
Code

The one-time code from the code parameter of the sign-in redirect’s URL fragment.

string
<= 64 characters
nonce
required
Nonce

The nonce the page sent when it started this sign-in.

string
<= 64 characters
Example generated
{
"code": "example",
"nonce": "example"
}

Successful Response

Media type application/json
TokenResponse
object
access_token
required
Access Token

JWT access token for Authorization header

string
refresh_token
required
Any of:
string
token_type
Token Type
string
default: bearer
expires_in
required
Expires In

Seconds until the access token expires

integer
Example
{
"token_type": "bearer"
}

Bad request — invalid query parameters or payload

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Unauthorized — missing or invalid credentials

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Forbidden — caller lacks access to this resource

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Not found

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Validation error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Too many requests — retry after the advertised interval

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}
Retry-After
integer

Seconds until the request may be retried

Internal server error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Service unavailable — the database could not serve the request

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string
Example
{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}