---
title: "Get Tokens By Code"
method: POST
path: "/get-tokens-by-code"
tags: ["developers"]
---

# Get Tokens By Code

`POST /get-tokens-by-code`

Get tokens by code

## Headers

- `Authorization` string
- `AuthorizationOxdId` string

## Request body

- object
  - `oxd_id` string, required
  - `code` string, required
  - `state` string, required
  - `authentication_method` string — if value is missed then basic authentication is used. Otherwise it's possible to set `private_key_jwt` value for Private Key authentication.
  - `algorithm` string — optional but is required if authentication_method=private_key_jwt. Valid values are none, HS256, HS384, HS512, RS256, RS384, RS512, ES256, ES384, ES512

## Response `200`

OK

- object
  - `access_token` string, required
  - `expires_in` integer, required
  - `id_token` string, required
  - `refresh_token` string, required
  - `id_token_claims` object, required

## Other responses

- `400` — Invalid parameters are provided to endpoint.
- `403` — Forbidden. Invalid access token provided in Authorization header.
- `500` — Internal error occured. Please check oxd-server.log file for details (usually located in /var/log/oxd-server/oxd-server.log).

## Changes

- **2020-09-02** `e3c2f8028bfe` — 2 info
  - added the new optional request property `algorithm`
  - added the new optional request property `authentication_method`
- **2020-04-22** `413442ee9280` — 1 info
  - added the new optional `header` request parameter `AuthorizationOxdId`
- **2020-02-13** `5ce3fb45d806` — 5 info
  - added optional request body
  - added the media type `application/json` for the response with the status `200`
  - added the media type `application/json` for the response with the status `400`
  - added the media type `application/json` for the response with the status `403`
  - …1 more
- **2018-11-30** `c28eaefdb285` — 5 breaking, 1 warning
  - removed the request body
  - removed the media type `application/json` for the response with the status `200`
  - removed the media type `application/json` for the response with the status `400`
  - removed the media type `application/json` for the response with the status `403`
  - …2 more

[Change history](https://skmtc.dev/gluufederation/apis/oxd-server/changes/get-tokens-by-code/post.md)

---

[API](https://skmtc.dev/gluufederation/apis/oxd-server.md) · [All operations](https://skmtc.dev/gluufederation/apis/oxd-server/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/gluufederation/oxd-server/revisions/33ca9e18c54b/schema)
