Finish signing in with a provider
const url = 'http://localhost:8080/api/v1/auth/exchange';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"code":"example","codeVerifier":"example","device":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/auth/exchange \ --header 'Content-Type: application/json' \ --data '{ "code": "example", "codeVerifier": "example", "device": "example" }'Trades the one-time code from the redirect, and the PKCE verifier the sign-in started with, for a session. Each code works once, even when the verifier is wrong. A code from linking links the provider account to the user who started it and returns that user without a token.
Someone signing in for the first time gets an account only when the
provider allows it (CHEK_OIDC_<ID>_CREATE_USERS); otherwise they
link the provider from an account they already have.
Request Bodyrequired
Section titled “Request Bodyrequired”object
A label for this session, such as “Living room iPad”.
Example generated
{ "code": "example", "codeVerifier": "example", "device": "example"}Responses
Section titled “Responses”Signed in, or linked.
object
Send as Authorization: Bearer <token>. Absent after linking.
object
Libraries a reader may open. Empty for admins, who see every library.
True on /api/v1/me for a shared demo account, which can’t change its settings. Absent otherwise.
Example
{ "user": { "role": "admin" }}The request was malformed.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}No account is linked to this provider account, and the provider doesn’t create accounts (not_linked).
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The provider account is linked to someone else, or this user already has another account at the provider (identity_taken).
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}The server failed; details are in its log.
object
Explains the problem to a developer.
Example
{ "code": "bad_request"}