Arctic

WorkOS

For usage, see OAuth 2.0 provider.

import { WorkOS } from "arctic";

const workos = new WorkOS(clientId, clientSecret, redirectURI);
const url: URL = await workos.createAuthorizationURL(state);
const tokens: WorkOSTokens = await workos.validateAuthorizationCode(code);

Get user profile

Use the /sso/profile endpoint.

const response = await fetch("https://api.workos.com/sso/profile", {
	headers: {
		Authorization: `Bearer ${tokens.accessToken}`
	}
});
const user = await response.json();