Arctic v1

Yandex

For usage, see OAuth 2.0 provider.

import { Yandex } from "arctic";

const yandex = new Yandex(clientId, clientSecret, {
	// optional
	redirectURI
});
const url: URL = await yandex.createAuthorizationURL(state, {
	// optional
	scopes
});
const tokens: YandexTokens = await yandex.validateAuthorizationCode(code);
const tokens: YandexTokens = await yandex.refreshAccessToken(refreshToken);

Get user profile

Use the /myself endpoint.

const response = await fetch("https://api.tracker.yandex.net/v2/myself", {
	headers: {
		Authorization: `OAuth ${tokens.accessToken}`,
		"X-Org-ID": ORGANIZATION_ID
	}
});
const user = await response.json();