### Install Arctic v3 Source: https://arcticjs.dev/guides/migrate-v3 Installs the latest version of the Arctic library using npm. This is the initial step for migrating to v3. ```bash npm install arctic@latest ``` -------------------------------- ### Install Arctic Package Source: https://arcticjs.dev/index Command to install the Arctic package using npm. This is the primary method for incorporating Arctic into a project. ```bash npm install arctic ``` -------------------------------- ### Initialize GitHub OAuth Provider Source: https://arcticjs.dev/providers/github Initializes the Arctic GitHub OAuth 2.0 provider. The redirect URI is optional but required by GitHub if multiple URIs are defined. This setup is crucial for starting the OAuth flow. ```typescript import * as arctic from "arctic"; const github = new arctic.GitHub(clientId, clientSecret, null); const github = new arctic.GitHub(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/startgg Retrieves the current user's profile information from Start.gg using the GraphQL API. ```APIDOC ## Get User Profile ### Description Retrieves the current user's profile information from Start.gg using the GraphQL API. Requires the `user.identity` scope and optionally `user.email` scope for email address. Refer to the [Start.gg Schema](https://start.gg/docs/graphql/schema) for available fields. ### Method `POST` ### Endpoint `https://api.start.gg/gql/alpha` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **query** (string) - Required - The GraphQL query string. ### Request Example ```javascript const accessToken = "YOUR_ACCESS_TOKEN"; const response = await fetch("https://api.start.gg/gql/alpha", { method: "POST", body: JSON.stringify({ query: "{ currentUser { id slug email player { gamerTag } } }" }), headers: { "Content-type": "application/json", Authorization: `Bearer ${accessToken}` } }); const result = await response.json(); console.log(result); ``` ### Response #### Success Response (200) Returns the user profile data based on the provided GraphQL query. #### Response Example ```json { "data": { "currentUser": { "id": "12345", "slug": "user-slug", "email": "user@example.com", "player": { "gamerTag": "GamerTag123" } } } } ``` ``` -------------------------------- ### Initialize GitHub OAuth Client and Get Tokens Source: https://arcticjs.dev/index Demonstrates how to initialize the Arctic GitHub OAuth client, generate an authorization URL, and validate the authorization code to obtain tokens. Requires 'arctic' package. ```typescript import * as arctic from "arctic"; const github = new arctic.GitHub(clientId, clientSecret, redirectURI); const state = arctic.generateState(); const scopes = ["user:email"]; const authorizationURL = github.createAuthorizationURL(state, scopes); // ... const tokens = await github.validateAuthorizationCode(code); const accessToken = tokens.accessToken(); ``` -------------------------------- ### Configure Self-Hosted Providers with Arctic.js Source: https://arcticjs.dev/guides/migrate-v3 Illustrates how to configure self-hosted providers, such as GitLab, using a unified `baseURL` parameter in their constructors. This change affects specific providers like GitLab and Authentik. ```typescript import * as arctic from "arctic"; // Must include the protocol, can include path segments const baseURL = "https://my-instance.com/auth"; const gitlab = new arctic.GitLab(baseURL, clientId, clientSecret, redirectURI); ``` -------------------------------- ### Initialize Public OAuth Client with Arctic.js Source: https://arcticjs.dev/guides/migrate-v3 Demonstrates how to initialize a public OAuth client for providers like Keycloak by passing `null` for the `clientSecret`. This is a new feature in v3 for providers supporting public clients. ```typescript import * as arctic from "arctic"; const keycloak = new arctic.KeyCloak(clientId, null, redirectURI); ``` -------------------------------- ### Initialize Dropbox OAuth 2.0 Provider Source: https://arcticjs.dev/providers/dropbox Initializes the Arctic Dropbox OAuth 2.0 provider with client credentials and redirect URI. This is the first step to start the authentication process. ```typescript import * as arctic from "arctic"; const dropbox = new arctic.Dropbox(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Initialization Source: https://arcticjs.dev/providers/startgg Initialize the Start.gg OAuth 2.0 provider with your client ID, client secret, and redirect URI. ```APIDOC ## Initialization ### Description Initialize the Start.gg OAuth 2.0 provider with your client ID, client secret, and redirect URI. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import * as arctic from "arctic"; const clientId = "YOUR_CLIENT_ID"; const clientSecret = "YOUR_CLIENT_SECRET"; const redirectURI = "YOUR_REDIRECT_URI"; const startgg = new arctic.StartGG(clientId, clientSecret, redirectURI); ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Initialize Start.gg OAuth Provider Source: https://arcticjs.dev/providers/startgg Initializes the Start.gg OAuth 2.0 provider with client credentials and a redirect URI. This is the first step to using the library for Start.gg authentication. ```typescript import * as arctic from "arctic"; const startgg = new arctic.StartGG(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/epicgames Retrieve basic user profile information by making a GET request to the `/v2/userInfo` endpoint with the `basic_profile` scope and an access token. ```APIDOC ## Get User Profile ### Description Retrieve basic user profile information by making a GET request to the `/v2/userInfo` endpoint. Ensure the `basic_profile` scope was requested during authorization and include the access token in the `Authorization` header. ### Method GET ### Endpoint `https://api.epicgames.dev/epic/oauth/v2/userInfo` ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```javascript // Assumes you have obtained an accessToken const response = await fetch("https://api.epicgames.dev/epic/oauth/v2/userInfo", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - An object containing the user's profile information (structure depends on Epic Games API). ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/etsy Retrieves the authenticated user's profile information from Etsy, requiring specific scopes and a two-step process involving getting the user ID first. ```APIDOC ## Get User Profile Retrieves the profile information of the currently authenticated user. ### Description This process requires the `shops_r` and `email_r` scopes. It involves two API calls: first to get the user's ID using `getMe`, and then to fetch the full user profile using the obtained user ID. ### Method `GET` (for both internal calls) ### Endpoint 1. `https://openapi.etsy.com/v3/application/users/me` 2. `https://openapi.etsy.com/v3/application/users/{userId}` ### Parameters #### Path Parameters - **userId** (string) - Required - The ID of the user to retrieve the profile for. #### Query Parameters None #### Request Body None ### Request Example ```typescript // First, obtain tokens (assuming you have code and codeVerifier) const tokens = await etsy.validateAuthorizationCode(code, codeVerifier); // 1. Get the current user's ID const meResponse = await fetch("https://openapi.etsy.com/v3/application/users/me", { headers: { "X-Api-Key": clientId, // Ensure clientId is accessible Authorization: `Bearer ${tokens.accessToken()}" } }); const meResult = await meResponse.json(); const userId = meResult.user_id; // 2. Get the user profile using the user ID const userResponse = await fetch(`https://openapi.etsy.com/v3/application/users/${userId}`, { headers: { "X-Api-Key": clientId, // Ensure clientId is accessible Authorization: `Bearer ${tokens.accessToken()}" } }); const user = await userResponse.json(); console.log(user); ``` ### Response #### Success Response (200) - **user** (object) - Contains the user's profile information. The exact fields depend on the scopes granted. - **user_id** (integer) - The unique identifier for the user. - (Other profile fields like `login_name`, `primary_email`, etc., depending on scopes) #### Response Example ```json { "user_id": 12345678, "login_name": "example_user", "primary_email": "user@example.com", "profile": { "bio": "This is a sample bio." } // ... other profile fields } ``` #### Error Responses - **401 Unauthorized**: Invalid or expired access token. - **403 Forbidden**: Insufficient scopes granted. - **404 Not Found**: User not found (unlikely for the `/me` endpoint, possible for `/users/{userId}` if ID is incorrect). - **5xx Server Error**: Etsy API server issues. ``` -------------------------------- ### Get Coinbase User Profile Source: https://arcticjs.dev/providers/coinbase Fetches the user's profile information from the Coinbase API using a valid access token. It makes a GET request to the /user endpoint. ```javascript const response = await fetch("https://api.coinbase.com/v2/user", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` -------------------------------- ### Get User Profile from DonationAlerts Source: https://arcticjs.dev/providers/donation-alerts Retrieves the user's profile information from DonationAlerts by making a GET request to the /user/oauth endpoint. Requires the `oauth-user-show` scope and a valid access token. ```typescript const scopes = ["oauth-user-show"]; const url = donationAlerts.createAuthorizationURL(state, scopes); ``` ```typescript const response = await fetch("https://www.donationalerts.com/api/v1/user/oauth", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` -------------------------------- ### Create Authorization URL Source: https://arcticjs.dev/providers/startgg Generates the Start.gg authorization URL to redirect users to for authentication. ```APIDOC ## Create Authorization URL ### Description Generates the Start.gg authorization URL to redirect users to for authentication. Requires `user.identity` and `user.email` scopes. ### Method `createAuthorizationURL(state: string, scopes: string[])` ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import * as arctic from "arctic"; const state = arctic.generateState(); const scopes = ["user.identity", "user.email"]; const url = startgg.createAuthorizationURL(state, scopes); console.log(url); ``` ### Response #### Success Response (200) Returns the authorization URL as a string. #### Response Example `https://start.gg/auth?response_type=code&client_id=...&redirect_uri=...&scope=user.identity%20user.email&state=...` ``` -------------------------------- ### Get Dribbble User Profile (JavaScript) Source: https://arcticjs.dev/providers/dribbble Fetches the user's profile information from the Dribbble API using the obtained access token. This involves making a GET request to the `/user` endpoint. ```javascript const response = await fetch("https://api.dribbble.com/v2/user", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` -------------------------------- ### OAuth2Client Initialization Source: https://arcticjs.dev/guides/generic-oauth2-client Initialize the OAuth2Client with your client ID, client password (secret), and redirect URI. Client secret and redirect URI can be null. ```APIDOC ## Initialization Initialize `OAuth2Client` with your client ID, client password (secret), and redirect URI. `clientSecret` and `redirectURI` can be `null`. ```typescript import * as arctic from "arctic"; const clientId = "your_client_id"; const clientPassword = "your_client_password"; const redirectURI = "your_redirect_uri"; const client = new arctic.OAuth2Client(clientId, clientPassword, redirectURI); ``` ``` -------------------------------- ### Get Lichess User Profile (JavaScript) Source: https://arcticjs.dev/providers/lichess Fetches the authenticated user's profile information from the Lichess API. It requires a valid access token and makes a GET request to the '/api/account' endpoint. The response is parsed as JSON. ```javascript const lichessUserResponse = await fetch("https://lichess.org/api/account", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await lichessUserResponse.json(); ``` -------------------------------- ### Initialization Source: https://arcticjs.dev/providers/bitbucket Initialize the Bitbucket OAuth 2.0 provider with your client ID, client secret, and redirect URI. ```APIDOC ## Initialization ### Description Initialize the Bitbucket OAuth 2.0 provider with your client ID, client secret, and redirect URI. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript import * as arctic from "arctic"; const clientId = "YOUR_CLIENT_ID"; const clientSecret = "YOUR_CLIENT_SECRET"; const redirectURI = "YOUR_REDIRECT_URI"; const bitBucket = new arctic.Bitbucket(clientId, clientSecret, redirectURI); ``` ### Response N/A ``` -------------------------------- ### Get Lichess User Email (JavaScript) Source: https://arcticjs.dev/providers/lichess Fetches the authenticated user's email address from the Lichess API. This requires the 'email:read' scope to be granted during authorization and makes a GET request to the '/api/account/email' endpoint with the access token. ```javascript const response = await fetch("https://lichess.org/api/account/email", { headers: { Authorization: `Bearer ${accessToken}` } }); const email = await response.json(); ``` -------------------------------- ### Create Authorization URL Source: https://arcticjs.dev/guides/generic-oauth2-client Generates a URL to initiate the OAuth 2.0 authorization code flow. Supports both standard and PKCE flows. ```APIDOC ## Create authorization URL Use `OAuth2Client.createAuthorizationURL()` to create an authorization URL. ```typescript import * as arctic from "arctic"; const authorizationEndpoint = "https://example.com/auth"; const state = arctic.generateState(); const scopes = ["read", "write"]; const url = client.createAuthorizationURL(authorizationEndpoint, state, scopes); console.log(url); ``` For PKCE flows, use `OAuth2Client.createAuthorizationURLWithPKCE()`. ```typescript import * as arctic from "arctic"; const authorizationEndpoint = "https://example.com/auth"; const state = arctic.generateState(); const codeVerifier = arctic.generateCodeVerifier(); const scopes = ["read", "write"]; const url = client.createAuthorizationURLWithPKCE( authorizationEndpoint, state, arctic.CodeChallengeMethod.S256, codeVerifier, scopes ); console.log(url); ``` ``` -------------------------------- ### OpenID Connect - Get ID Token and User Info Source: https://arcticjs.dev/providers/amazon-cognito Integrates OpenID Connect to retrieve user profile information. This involves using the 'openid' scope to get an ID token or accessing the 'userinfo' endpoint. ArcticJS provides `decodeIdToken` for payload decoding. ```typescript const scopes = ["openid"]; const url = cognito.createAuthorizationURL(state, codeVerifier, scopes); ``` ```typescript import * as arctic from "arctic"; const tokens = await cognito.validateAuthorizationCode(code, codeVerifier); const idToken = tokens.idToken(); const claims = arctic.decodeIdToken(idToken); ``` ```typescript const response = await fetch(userPool + "/oauth/userInfo", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` -------------------------------- ### Auth0 Initialization Source: https://arcticjs.dev/providers/auth0 Initialize the Auth0 provider with your domain, client ID, client secret (for confidential clients), and redirect URI. ```APIDOC ## Initialization The domain should not include the protocol or path. Pass the client secret for confidential clients. ```javascript import * as arctic from "arctic"; const domain = "xxx.auth0.com"; const clientId = "YOUR_CLIENT_ID"; const clientSecret = "YOUR_CLIENT_SECRET"; const redirectURI = "YOUR_REDIRECT_URI"; // For confidential clients const auth0 = new arctic.Auth0(domain, clientId, clientSecret, redirectURI); // For public clients (clientSecret is null) const auth0 = new arctic.Auth0(domain, clientId, null, redirectURI); ``` ``` -------------------------------- ### Initialize MercadoLibre OAuth Client Source: https://arcticjs.dev/providers/mercadolibre Initializes the MercadoLibre OAuth client with provided credentials and redirect URI. Requires the 'arctic' library. ```typescript import * as arctic from "arctic"; const mercadolibre = new arctic.MercadoLibre(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get Figma User Profile via API Source: https://arcticjs.dev/providers/figma Fetches the current user's profile information from the Figma API using a provided access token. This involves making a GET request to the `/v1/me` endpoint and parsing the JSON response. ```javascript const response = await fetch("https://api.figma.com/v1/me", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` -------------------------------- ### Create Start.gg Authorization URL Source: https://arcticjs.dev/providers/startgg Generates a URL for initiating the OAuth 2.0 authorization flow with Start.gg. It requires a state parameter for security and a list of desired scopes. ```typescript import * as arctic from "arctic"; const state = arctic.generateState(); const scopes = ["user.identity", "user.email"]; const url = startgg.createAuthorizationURL(state, scopes); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/strava Retrieves the authenticated user's profile information from Strava. ```APIDOC ## Get User Profile ### Description Retrieves the authenticated user's profile information from Strava. Requires the `read` scope for basic profile data, or `read_all` for all private data. ### Method GET ### Endpoint `/api/v3/athlete` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript // Ensure you have obtained an accessToken first, e.g., using validateAuthorizationCode or refreshAccessToken const accessToken = "YOUR_ACCESS_TOKEN"; // Replace with the actual access token const response = await fetch("https://www.strava.com/api/v3/athlete", { headers: { Authorization: `Bearer ${accessToken}` } }); if (!response.ok) { // Handle API errors console.error("Failed to fetch user profile:", response.status, response.statusText); return; } const user = await response.json(); console.log("User Profile:", user); ``` ### Response #### Success Response (200) - **id** (integer) - The user's unique Strava ID. - **username** (string) - The user's Strava username. - **firstname** (string) - The user's first name. - **lastname** (string) - The user's last name. - **profile_medium** (string) - URL to the user's medium profile picture. - **profile** (string) - URL to the user's profile picture. - **city** (string) - The user's city. - **state** (string) - The user's state. - **country** (string) - The user's country. - **sex** (string) - The user's sex. - **athlete_type** (integer) - The user's athlete type (e.g., 1 for Runner, 2 for Cyclist). - **created_at** (string) - ISO 8601 timestamp of when the user account was created. - **updated_at** (string) - ISO 8601 timestamp of when the user account was last updated. *Note: Other fields may be available depending on the granted scopes.* #### Response Example ```json { "id": 12345, "username": "john_doe", "firstname": "John", "lastname": "Doe", "profile_medium": "https://strava.com/..., "profile": "https://strava.com/... "city": "San Francisco", "state": "CA", "country": "USA", "sex": "male", "athlete_type": 1, "created_at": "2010-01-01T12:00:00Z", "updated_at": "2023-10-26T10:00:00Z" } ``` ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/donation-alerts Retrieves the authenticated user's profile information from DonationAlerts. ```APIDOC ### Get User Profile Retrieves the authenticated user's profile. Requires the `oauth-user-show` scope. ### Endpoint `/user/oauth` ### Method `GET` ### Headers - **Authorization** (string) - Required - Bearer token: `Bearer YOUR_ACCESS_TOKEN` ### Request Example ```typescript const response = await fetch("https://www.donationalerts.com/api/v1/user/oauth", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - User profile details. ``` -------------------------------- ### Initialize osu! OAuth Provider Source: https://arcticjs.dev/providers/osu Initializes the Arctic osu! OAuth provider with client credentials and a redirect URI. This is the first step required before interacting with osu!'s OAuth endpoints. It requires the `arctic` library to be imported. ```typescript import * as arctic from "arctic"; const osu = new arctic.Osu(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Initialize GitHub OAuth Client Source: https://arcticjs.dev/guides/oauth2 Initializes the Arctic GitHub OAuth client with necessary credentials. Requires `clientId`, `clientSecret`, and `redirectURI` which are typically obtained from the OAuth provider. The API is designed to be consistent across providers. ```typescript import * as arctic from "arctic"; const github = new arctic.GitHub(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/kakao Retrieves the user's profile information using the access token. ```APIDOC ## Get user profile ### Description Retrieves the user's profile information. ### Method GET ### Endpoint https://kapi.kakao.com/v2/user/me ### Parameters N/A ### Request Example ```javascript const response = await fetch("https://kapi.kakao.com/v2/user/me", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - User profile information. ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/lichess Fetches the authenticated user's profile information from the Lichess API. ```APIDOC ## Get User Profile ### Description Fetches the authenticated user's profile information by making a request to the `/api/account` endpoint on Lichess. Requires a valid Bearer token in the Authorization header. ### Method GET ### Endpoint `/api/account` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript // Assuming 'accessToken' is obtained from validateAuthorizationCode const lichessUserResponse = await fetch("https://lichess.org/api/account", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await lichessUserResponse.json(); console.log(user); ``` ### Response #### Success Response (200) - **user** (object) - An object containing the user's profile details. #### Response Example ```json { "id": "username", "username": "User Name", "online": true, "perfs": { "chess": { "rating": 1500, "rd": 50, "prog": 0 } } // ... other profile fields } ``` ``` -------------------------------- ### Initialization Source: https://arcticjs.dev/providers/etsy Initializes the Arctic Etsy client with your application's client ID and redirect URI. ```APIDOC ## Initialization Initializes the Arctic Etsy client. ### Method N/A (Constructor) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import * as arctic from "arctic"; const etsy = new arctic.Etsy(clientId, redirectURI); ``` ### Response N/A #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/tiltify Retrieves the current authenticated user's profile information from the Tiltify API. ```APIDOC ## Get User Profile ### Description Fetches the profile information of the currently authenticated user. ### Method GET ### Endpoint `/api/public/current-user` ### Parameters No parameters are required for this endpoint. ### Request Headers - **Authorization**: `Bearer ` - The access token obtained from Tiltify. - **Client-Id**: `` - Your Tiltify application client ID. ### Response #### Success Response (200) - **user** (object) - An object containing the user's profile details. ``` -------------------------------- ### Initialization Source: https://arcticjs.dev/providers/mercadolibre Initialize the MercadoLibre client with your application's client ID, client secret, and redirect URI. ```APIDOC ## Initialization ### Description Initialize the MercadoLibre client with your application's client ID, client secret, and redirect URI. ### Method `new arctic.MercadoLibre(clientId, clientSecret, redirectURI)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript import * as arctic from "arctic"; const mercadolibre = new arctic.MercadoLibre(clientId, clientSecret, redirectURI); ``` ### Response #### Success Response (200) N/A (Constructor does not return a value) #### Response Example N/A ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/shikimori Fetches the current authenticated user's profile information from the Shikimori API. ```APIDOC ## Get User Profile ### Description Fetches the profile information of the currently authenticated user from the Shikimori API using the obtained access token. ### Method GET ### Endpoint `/api/users/whoami` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript // Assume 'accessToken' is obtained from validateAuthorizationCode or refreshAccessToken const accessToken = "your_access_token"; const response = await fetch("https://shikimori.one/api/users/whoami", { headers: { Authorization: `Bearer ${accessToken}` } }); if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } const user = await response.json(); console.log(user); ``` ### Response #### Success Response (200) - **user** (object) - An object containing the user's profile data. The exact fields depend on the Shikimori API response for `/api/users/whoami`. #### Response Example ```json { "id": 12345, "username": "example_user", "nickname": "Example", "avatar": { "x160": "url_to_avatar_160", "x96": "url_to_avatar_96" }, "}{- ... other user fields ... } } ``` ``` -------------------------------- ### Fetch Start.gg User Profile Source: https://arcticjs.dev/providers/startgg Retrieves the current user's profile information from Start.gg using a POST request to their GraphQL API. Requires the `user.identity` scope and optionally `user.email`. ```javascript const response = await fetch("https://api.start.gg/gql/alpha", { method: "POST", body: `{"query": "{ currentUser {id slug email player { gamerTag } } }" }`, headers: { "Content-type": "application/json", Authorization: `Bearer ${accessToken}` } }); const result = await response.json(); ``` -------------------------------- ### Okta Initialization Source: https://arcticjs.dev/providers/okta Initialize the Okta OAuth 2.0 provider. The `domain` should not include the protocol or path. The `authorizationServerId` is optional. ```APIDOC ## Okta Initialization ### Description Initialize the Okta OAuth 2.0 provider. The `domain` should not include the protocol or path. The `authorizationServerId` is optional. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```javascript import * as arctic from "arctic"; const domain = "auth.example.com"; const clientId = "YOUR_CLIENT_ID"; const clientSecret = "YOUR_CLIENT_SECRET"; const redirectURI = "YOUR_REDIRECT_URI"; // Without authorizationServerId const okta1 = new arctic.Okta(domain, null, clientId, clientSecret, redirectURI); // With authorizationServerId const authorizationServerId = "YOUR_AUTH_SERVER_ID"; const okta2 = new arctic.Okta(domain, authorizationServerId, clientId, clientSecret, redirectURI); ``` ### Response N/A (Constructor) ``` -------------------------------- ### Get User Profile - Scopes Source: https://arcticjs.dev/providers/google Specifies the scopes required to retrieve user profile and email information from Google. ```APIDOC ### Get User Profile To retrieve the user's profile and email information, ensure you include the `profile` and `email` scopes when creating the authorization URL. ### Request Example (Scopes) ```javascript const scopes = ["openid", "profile", "email"]; const url = google.createAuthorizationURL(state, codeVerifier, scopes); ``` ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/facebook Fetches the user's profile information from Facebook using the `/me` endpoint. ```APIDOC ## Get User Profile ### Description Fetches the user's profile information from Facebook using the `/me` endpoint. You can specify the fields you want to retrieve. ### Method `fetch()` (using standard JavaScript Fetch API) ### Endpoint `https://graph.facebook.com/me` ### Parameters #### Path Parameters N/A #### Query Parameters - **access_token** (string) - Required - The access token obtained from `validateAuthorizationCode()`. - **fields** (string) - Optional - A comma-separated list of fields to retrieve (e.g., `id`, `name`, `picture`, `email`). ### Request Example ```javascript const searchParams = new URLSearchParams(); searchParams.set("access_token", accessToken); searchParams.set("fields", ["id", "name", "picture", "email"].join(",")); const response = await fetch("https://graph.facebook.com/me" + "?" + searchParams.toString()); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - An object containing the requested user profile fields. #### Response Example ```json { "id": "...", "name": "John Doe", "picture": { "data": { "height": 50, "is_silhouette": false, "url": "...", "width": 50 } }, "email": "john.doe@example.com" } ``` ``` -------------------------------- ### Configure Custom Domain Providers with Arctic.js Source: https://arcticjs.dev/guides/migrate-v3 Demonstrates configuring providers hosted under a custom domain, like AWS Cognito, using a unified `domain` parameter in their constructors. The domain should not include the protocol or path segments. ```typescript import * as arctic from "arctic"; // Must not include the protocol or path segments const domain = "my-domain.com"; const cognito = new arctic.AmazonCognito(domain, clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/42 Retrieve the authenticated user's profile information from the /v2/me endpoint. ```APIDOC ## Get user profile Retrieves the current user's profile information using the access token. ### Method GET ### Endpoint /v2/me ### Parameters #### Headers - **Authorization** (string) - Required - `Bearer ` ### Request Example ```javascript const response = await fetch("https://api.intra.42.fr/v2/me", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - An object containing the user's profile information. ``` -------------------------------- ### Initialize Arctic Patreon Provider Source: https://arcticjs.dev/providers/patreon Initializes the Arctic Patreon OAuth 2.0 provider with client credentials and redirect URI. Requires the `arctic` library. No specific inputs or outputs beyond setting up the provider instance. ```typescript import * as arctic from "arctic"; const patreon = new arctic.Patreon(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/salesforce Ensures the necessary scopes (`profile`, `email`) are included to retrieve user profile and email information. ```APIDOC ### Get user profile Make sure to add the `profile` scope to get the user profile and the `email` scope to get the user email. ```javascript const scopes = ["openid", "profile", "email"]; const url = salesforce.createAuthorizationURL(state, codeVerifier, scopes); ``` ``` -------------------------------- ### Initialization Source: https://arcticjs.dev/providers/tiltify Initialize the Tiltify OAuth 2.0 provider with your client ID, client secret, and redirect URI. ```APIDOC ## Initialization ### Description Initializes the Tiltify OAuth 2.0 provider. ### Method Constructor ### Parameters - **clientId** (string) - Required - Your Tiltify application client ID. - **clientSecret** (string) - Required - Your Tiltify application client secret. - **redirectURI** (string) - Required - The redirect URI registered with Tiltify. ``` -------------------------------- ### Get User Profile with Scopes Source: https://arcticjs.dev/providers/line Requests user profile and email information by including 'profile' and 'email' scopes. ```APIDOC ## Get User Profile with Scopes Requests user profile and email information by including the `profile` and `email` scopes when creating the authorization URL. Alternatively, you can use the `/profile` endpoint directly. ### Method N/A (Instance method for URL creation) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript const scopes = ["openid", "profile", "email"]; const url = line.createAuthorizationURL(state, codeVerifier, scopes); ``` ### Response #### Success Response (200) - **url** (string) - The authorization URL with the specified scopes. ``` -------------------------------- ### Initialize Bitbucket OAuth Provider Source: https://arcticjs.dev/providers/bitbucket Initializes the Bitbucket OAuth 2.0 provider with your client ID, client secret, and redirect URI. This is the first step in setting up the authentication flow. ```typescript import * as arctic from "arctic"; const bitBucket = new arctic.Bitbucket(clientId, clientSecret, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/figma Fetches the currently authenticated user's profile information from the Figma API. ```APIDOC ## Get User Profile ### Description Fetches the currently authenticated user's profile information from the Figma API using the `/me` endpoint. ### Method GET ### Endpoint `/v1/me` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript const accessToken = "YOUR_ACCESS_TOKEN"; // Obtained from validateAuthorizationCode or refreshAccessToken const response = await fetch("https://api.figma.com/v1/me", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); console.log(user); ``` ### Response #### Success Response (200) - **id** (string) - The user's unique ID. - **email** (string) - The user's email address. - **handle** (string) - The user's handle or username. - **full_name** (string) - The user's full name. - **img_url** (string) - URL to the user's profile picture. - **access_level** (string) - The user's access level (e.g., 'ADMIN', 'EDITOR', 'VIEWER'). - **iesa_user** (boolean) - Indicates if the user is an IESA user. #### Response Example ```json { "id": "12345", "email": "user@example.com", "handle": "example_user", "full_name": "Example User", "img_url": "https://example.com/avatar.png", "access_level": "EDITOR", "iesa_user": false } ``` #### Error Responses - **401 Unauthorized**: If the access token is invalid or expired. - **403 Forbidden**: If the token does not have the necessary scope to access this endpoint. ``` -------------------------------- ### Figma Initialization Source: https://arcticjs.dev/providers/figma Initializes the Figma OAuth 2.0 provider with your client ID, client secret, and redirect URI. ```APIDOC ## Initialization ### Description Initializes the Figma OAuth 2.0 provider with your client ID, client secret, and redirect URI. ### Method N/A (Constructor) ### Endpoint N/A (Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript import * as arctic from "arctic"; const figma = new arctic.Figma(clientId, clientSecret, redirectURI); ``` ### Response N/A (Constructor) #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### Get User Profile Scopes with Auth0 Source: https://arcticjs.dev/providers/auth0 Specifies the scopes required to retrieve user profile and email information from Auth0. ```typescript const scopes = ["openid", "profile", "email"]; const url = auth0.createAuthorizationURL(state, codeVerifier, scopes); ``` -------------------------------- ### Initialize Arctic OAuth2Client Source: https://arcticjs.dev/guides/generic-oauth2-client Initializes the OAuth2Client with necessary credentials. Requires client ID and optionally client secret and redirect URI. This client adheres strictly to OAuth 2.0 RFCs. ```typescript import * as arctic from "arctic"; const client = new arctic.OAuth2Client(clientId, clientPassword, redirectURI); ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/dribbble Retrieves the authenticated user's profile information from Dribbble's API. ```APIDOC ## Get User Profile ### Description Retrieves the authenticated user's profile information from Dribbble's API using the `/user` endpoint. ### Method `GET` ### Endpoint `/v2/user` ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body N/A ### Request Example ```javascript const response = await fetch("https://api.dribbble.com/v2/user", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - User profile data. #### Response Example ```json { "id": 12345, "name": "John Doe", "username": "johndoe", "avatar_url": "..." } ``` ``` -------------------------------- ### Get User Profile Source: https://arcticjs.dev/providers/tumblr Retrieves the current user's profile information from the Tumblr API using the access token. ```APIDOC ## Get User Profile ### Description Retrieves the current user's profile information from the Tumblr API using the access token. This endpoint is part of the Tumblr API itself, not directly a method of the Arctic library. ### Method `fetch()` with GET request to `https://api.tumblr.com/v2/user/info` ### Endpoint `https://api.tumblr.com/v2/user/info` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Headers - **Authorization** (string) - Required - `Bearer YOUR_ACCESS_TOKEN` ### Request Example ```javascript const response = await fetch("https://api.tumblr.com/v2/user/info", { headers: { Authorization: `Bearer ${accessToken}` } }); const user = await response.json(); ``` ### Response #### Success Response (200) - **user** (object) - Contains the user's profile information. The exact structure depends on the Tumblr API response. #### Example Response Body (structure may vary) ```json { "response": { "user": { "name": "exampleuser", "likes": 123, "following": 456, "url": "http://exampleuser.tumblr.com/" } } } ``` ``` -------------------------------- ### Handle Public vs. Confidential Clients in Arctic.js Source: https://arcticjs.dev/guides/migrate-v3 Shows the difference in creating authorization URLs and validating authorization codes between confidential (existing) and public (new) clients in Arctic v3. Public clients may require a `codeVerifier`. ```typescript // Confidential clients (existing projects) const url = discord.createAuthorizationURL(state, null, scopes); const tokens = await discord.validateAuthorizationCode(code, null); // Public clients const url = discord.createAuthorizationURL(state, codeVerifier, scopes); const tokens = await discord.validateAuthorizationCode(code, codeVerifier); ``` -------------------------------- ### Get Measures Source: https://arcticjs.dev/providers/withings Retrieve user measures from the Withings API using the `/measure` endpoint. Requires an authenticated Bearer token. ```APIDOC ## Get Measures ### Description Retrieve user measures from the Withings API using the `/measure` endpoint. Requires an authenticated Bearer token. ### Method POST ### Endpoint `https://wbsapi.withings.net/measure` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **action** (string) - Required - Must be `getmeas`. - **meastypes** (string) - Required - Comma-separated list of measurement types (e.g., "1,5,6,8,76"). - **category** (integer) - Required - The category of the measurement (e.g., 1 for Weight). - **lastupdate** (integer) - Optional - Unix timestamp to fetch updates since the last update. ### Request Example ```javascript const response = await fetch("https://wbsapi.withings.net/measure", { method: "POST", headers: { Authorization: `Bearer ${tokens.accessToken()}`, "Content-Type": "application/json" }, body: JSON.stringify({ action: "getmeas", meastypes: "1,5,6,8,76", category: 1, lastupdate: 1746082800 }) }); const measures = await response.json(); ``` ### Response #### Success Response (JSON) - **body** (object) - Contains the measurement data. - **measures** (array) - Array of measure objects. - **type** (integer) - The type of measure. - **value** (integer) - The measure value. - **unit** (string) - The unit of the measure. - **வதை** (integer) - The timestamp of the measurement. #### Response Example ```json { "status": 200, "body": { "updatestatus": 1, "more": false, "measures": [ { "type": 1, "value": 70500, "unit": "GR", "வதை": 1746082800 } ] } } ``` ``` -------------------------------- ### Initialize Spotify Client with Arctic JS Source: https://arcticjs.dev/providers/spotify Initializes the Arctic JS Spotify client. For confidential clients, provide the client secret. For public clients, set the client secret to null. Requires 'arctic' library and client credentials. ```typescript import * as arctic from "arctic"; const spotify = new arctic.Spotify(clientId, clientSecret, redirectURI); const spotify = new arctic.Spotify(clientId, null, redirectURI); ``` -------------------------------- ### Initialize Arctic Okta Provider Source: https://arcticjs.dev/providers/okta Initializes the Arctic Okta OAuth 2.0 provider. The `domain` should not include protocol or path. The `authorizationServerId` is optional. Requires `clientId`, `clientSecret`, and `redirectURI`. ```typescript import * as arctic from "arctic"; const domain = "auth.example.com"; // Without authorizationServerId const okta1 = new arctic.Okta(domain, null, clientId, clientSecret, redirectURI); // With authorizationServerId const okta2 = new arctic.Okta(domain, authorizationServerId, clientId, clientSecret, redirectURI); ``` -------------------------------- ### OpenID Connect - Decode ID Token Source: https://arcticjs.dev/providers/line Decodes the ID token received from Line to get user profile information. ```APIDOC ## OpenID Connect - Decode ID Token Use OpenID Connect with the `openid` scope to get the user's profile with an ID token. Arctic provides `decodeIdToken()` for decoding the token's payload. ### Method N/A (Static method for decoding) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```typescript import * as arctic from "arctic"; // When creating authorization URL const scopes = ["openid"]; const url = line.createAuthorizationURL(state, codeVerifier, scopes); // After validating authorization code const tokens = await line.validateAuthorizationCode(code, codeVerifier); const idToken = tokens.idToken(); const claims = arctic.decodeIdToken(idToken); ``` ### Response #### Success Response (200) - **claims** (object) - The decoded payload of the ID token. ```