naystack - v1.5.10
    Preparing search index...

    Function getInstagramAuthorizationURLSetup

    • Creates a function that builds the Instagram OAuth authorization URL for a given state token. The state token is typically the user's access token, used to link the Instagram account to the logged-in user.

      Parameters

      • redirectURL: string

        The OAuth redirect URI registered with Instagram (e.g. NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT).

      Returns (token: string) => string

      A function (stateToken: string) => string that returns the full authorization URL.

      import { getInstagramAuthorizationURLSetup } from "naystack/auth/instagram/client";

      const getAuthURL = getInstagramAuthorizationURLSetup("/api/instagram");
      const url = getAuthURL(userAccessToken);
      // => "https://www.instagram.com/oauth/authorize?client_id=...&state=...&redirect_uri=..."
      window.location.href = url;