Skip to the content

Logging out

Logging out revokes the refresh token at the login server, so it stops working everywhere, and this page forgets it. Access tokens already made from it run out within five minutes.

Log out in the panel, or at the top of any page, logs this tab out. The samples on the right log out a script: they revoke the token saved in reconnectchina-token, and Python and the shell also delete the file.

Language
from reconnectchina import Client, OfflineTokenFile

client = Client(
    tokens=OfflineTokenFile("reconnectchina-token"),
)
client.logout()
login=https://api.reconnectchina.org/oauth
printf 'token=%s' "$(cat reconnectchina-token)" |
  curl -fsS "$login/revoke" -d client_id=reconnectchina-api -d token_type_hint=refresh_token -d @- &&
  rm reconnectchina-token
import { readFile, writeFile } from "node:fs/promises";
import { Client } from "@reconnectchina/client";

const file = "reconnectchina-token";
const client = new Client({
  tokens: {
    load: async () => ({
      refreshToken: (await readFile(file, "utf8")).trim(),
      offline: true,
    }),
    save: (tokens) => tokens && writeFile(file, tokens.refreshToken),
  },
});
await client.logout();

Not logged in.