Refresh access token

Use the refresh_token issued by signin to obtain a new access/refresh token pair (rotation).

POST/ops/v1/auth/refresh#

Request Body

refresh_tokenStringrequired
Refresh token issued by signin. It is invalidated by this call and replaced with a new one.

Response Fields

access_tokenStringrequired
Newly issued Bearer access token.
refresh_tokenStringrequired
Replacement refresh token from rotation. The previous value is invalidated.

If the refresh_token is invalid or expired, the response is 401 InvalidRefreshToken. In that case, prompt the user to sign in again. Since this is a rotation, you must save the new refresh_token from the response.

curl -X POST "https://opsapi.edutap.ai/ops/v1/auth/refresh" \
  -H "Content-Type: application/json" \
  -d '{
    "refresh_token": "eyJhbGciOi...refresh-payload..."
  }'
import requests

res = requests.post(
    "https://opsapi.edutap.ai/ops/v1/auth/refresh",
    json={
        "refresh_token": "eyJhbGciOi...refresh-payload..."
    },
)
print(res.json())
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	body := []byte(`{
	  "refresh_token": "eyJhbGciOi...refresh-payload..."
	}`)
	req, _ := http.NewRequest("POST", "https://opsapi.edutap.ai/ops/v1/auth/refresh", bytes.NewBuffer(body))
	req.Header.Set("Content-Type", "application/json")
	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	b, _ := io.ReadAll(res.Body)
	fmt.Println(string(b))
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
  public static void main(String[] args) throws Exception {
    String body = """
        {
          "refresh_token": "eyJhbGciOi...refresh-payload..."
        }
        """;
    HttpRequest req = HttpRequest.newBuilder()
        .uri(URI.create("https://opsapi.edutap.ai/ops/v1/auth/refresh"))
        .header("Content-Type", "application/json")
        .POST(HttpRequest.BodyPublishers.ofString(body))
        .build();
    HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
    System.out.println(res.body());
  }
}
const res = await fetch("https://opsapi.edutap.ai/ops/v1/auth/refresh", {
  method: "POST",
  headers: {"Content-Type": "application/json"},
  body: JSON.stringify({
    "refresh_token": "eyJhbGciOi...refresh-payload..."
  }),
});
console.log(await res.json());
Response
{
  "access_token": "eyJhbGciOi...new-payload...",
  "refresh_token": "eyJhbGciOi...new-refresh-payload..."
}