Implements OpenID Connect.

For usage, see OAuth 2.0 provider.

import { LinkedIn } from "arctic";

const linkedIn = new LinkedIn(clientId, clientSecret, redirectURI);
const url: URL = await linkedIn.createAuthorizationURL(state, {
	// optional
	scopes // "openid" always included
const tokens: LinkedInTokens = await linkedIn.validateAuthorizationCode(code);
const tokens: LinkedInTokens = await linkedIn.refreshAccessToken(refreshToken);

Get user profile

Add the profile scopes, and optionally add the email scope to get user email.

const url = await linkedIn.createAuthorizationURL(state, {
	scopes: ["profile", "email"]

Parse the ID token or use the userinfo endpoint. See ID token claims.

const tokens = await linkedIn.validateAuthorizationCode(code);
const response = await fetch("", {
	headers: {
		Authorization: `Bearer ${tokens.accessToken}`
const user = await response.json();