For the complete documentation index, see llms.txt. This page is also available as Markdown.

TossAuth.login

Functional API appLoginYou can use the same function with this as well.

Feature description

Log in with Toss authentication. Once login is complete, you will be moved back to the Toss app. The returned authorizationCodeand referrerPass the returned value to the server to continue the login process.

Type

TossAuth.login(): Promise<AppLoginResponse>;

Params

None

Response

type AppLoginResponse = {
  authorizationCode: string;
  referrer: "DEFAULT" | "SANDBOX";
};

Example code

import { TossAuth } from "@apps-in-toss/web-framework";

const button = document.querySelector("#login-button");

button.addEventListener("click", async () => {
  try {
    const { authorizationCode, referrer } = await TossAuth.login();
    // Send authorizationCode and referrer to the server
  } catch (error) {
    console.error(error);
  }
});

Was this helpful?