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

Toss Login

For service introduction and console setup instructions, Toss Login introduction documentplease refer to.

Basic information

Item
Value

Base URL

https://apps-in-toss-api.toss.im

Server authentication

mTLS (client certificate)

Content-Type

application/json

mTLS certificate is required for server-to-server communication

The Toss Login API is server-to-server communication called from the partner server to the Apps in Toss server. For security, set up an mTLS certificate on the server before making calls. How to issue a certificate is How to issue an mTLS certificateplease refer to.


1. Get an authorization code

SDK function: appLogin

appLoginuses the authentication flow of the Toss app to perform login, and when login succeeds, an authorization code (authorizationCode).

Please note

  • This step client (mini app) only performs the role of obtaining the authorization code.

  • After receiving the authorization code, token exchange / AccessToken issuance / user information lookupmust be handled on the server.

  • The validity period of the authorization code is 10 minutes.

  • The authorization code is one-time, and reuse will fail.

  • authorizationCodeDo not store it on the client for a long time.

  • Sensitive information (AccessToken, RefreshToken ) such as these should be stored safely on the server.

When you perform Toss Login for the first time appLogin If you call the function, the Toss Login window opens and the terms consent screen registered in the Apps in Toss console is shown. If the user agrees to the required terms, an authorization code is returned.

If Toss Login has already been performed appLogin If you call the function, an authorization code is returned immediately without a separate login window.

Signature

Return value

  • authorizationCode string

    This is the authorization code issued after user authentication is completed. Send it to the server and exchange it for an AccessToken.

  • referrer string

    Indicates the environment from which the login request occurred. DEFAULT: real Toss app environment, SANDBOX: sandbox environment

Example: Example of logging in through Toss authentication

Try the sample app

apps-in-toss-examples from the repository with-app-login Download the code and try it out.


2. Receive AccessToken

For calling the user information lookup API issue an access token.

  • Content-Type: application/json

  • Method: POST

  • URL: /api-partner/v1/apps-in-toss/user/oauth2/generate-token

See

The validity period of AccessToken is 1 hour.

Request

Name
Type
Whether required
Description

authorizationCode

string

Y

Authorization code

referrer

string

Y

referrer

Success response

Name
Type
Whether required
Description

tokenType

string

Y

fixed as bearer

accessToken

string

Y

accessToken

refreshToken

string

Y

refreshToken

expiresIn

string

Y

expiration time (seconds)

scope

string

Y

authorized scope (delimiter)

Failure response If the authorization code has expired or if you request AccessToken multiple times with the same authorization code

3. Receive AccessToken again

Reissue an access token for calling the user information lookup API.

  • Content-type : application/json

  • Method : POST

  • URL : /api-partner/v1/apps-in-toss/user/oauth2/refresh-token

See

The refreshToken validity period is 14 days.

Request

Name
Type
Whether required
Description

refreshToken

string

Y

Issued RefreshToken

Success response

Name
Type
Whether required
Description

tokenType

string

Y

fixed as bearer

accessToken

string

Y

accessToken

refreshToken

string

Y

refreshToken

expiresIn

string

Y

expiration time (seconds)

scope

string

Y

authorized scope (delimiter)

Failure response

Name
Type
Whether required
Description

errorCode

string

Y

Error code

reason

string

Y

Error message

4. Receive user information

Look up user information. DIis nullis returned, and can be called without any limit on the number of times. For privacy protection, all personal information is encrypted formprovided in.

  • Content-type : application/json

  • Method : GET

  • URL : /api-partner/v1/apps-in-toss/user/oauth2/login-me

scope to user_key will be added

scope The parameter is Among the items selected in the console, only the values the user has consented to are returned. From January 2, 2026 scope to the values, user_key items will be added. Due to the addition of new scopes, values that were not previously defined may be included, so please be careful to avoid exceptions when handling scope.

Request headers

Name
Type
Whether required
Description

Authorization

string

Y

Authentication request with AccessToken Authorization: Bearer ${AccessToken}

Success response

Name
Type
Whether required
Whether encrypted
Description

userKey

number

Y

N

This is a unique user identification value that can be used only in the corresponding app. Even for the same user, userKey may differ if the app is different.

scope

string

Y

N

This is the list of authorized scopes. It includes the values the user consented to among the items selected in the console and user_key items.

agreedTerms

list

Y

N

This is the list of terms the user agreed to.

name

string

N

Y

This is the user's name.

phone

string

N

Y

This is the user's mobile phone number.

birthday

string

N

Y

This is the user's date of birth. (yyyyMMdd)

ci

string

N

Y

This is the user's CI value.

di

string

N

Y

Always null is returned as a value.

gender

string

N

Y

This is the user's gender information. (MALE/FEMALE)

nationality

string

N

Y

This is whether the user is local or foreign. (LOCAL/FOREIGNER)

email

string

N

Y

This is the user's email information. It is not a verified value.

userKey is issued on an app basis

userKey is an identifier valid only in the corresponding app. Even for the same user, if the app differs, different userKeys are issued.

Failure response If you use an invalid token, check the validity period of the current access_token and reissue it.

Server error response example

errorCode
Description

INTERNAL_ERROR

Internal server error

USER_KEY_NOT_FOUND

Unable to find the user key value connected to the login service

USER_NOT_FOUND

Unable to find Toss user information

BAD_REQUEST_RETRIEVE_CERT_RESULT_EXCEEDED_LIMIT

Exceeded the number of queries available with the same token /api/login/user/me/without-di When querying the API, it is returned normally, but the di field comes back as null

5. Decrypt user information

Received by email through the console decryption keyand AAD (Additional Authenticated DATA) please proceed with.

Encryption algorithm

  • AES symmetric-key encryption

  • Key length: 256 bits

  • Mode: GCM

  • AAD: We send it by email together with the decryption key.

Data exchange method

  • The front part of the encrypted data includes the IV (NONCE).

  • For decryption, you must extract the IV from the ciphertext and use it for successful decryption.

Decryption sample code

Kotlin example
PHP example
JAVA example

6. Disconnect login

If you no longer use the issued AccessToken or need to expire the token at the user's request, delete(expire) the token.

  • Content-type : application/json

  • Method : POST

  • URL :

    • Disconnect with accessToken: /api-partner/v1/apps-in-toss/user/oauth2/access/remove-by-access-token

    • Disconnect with userKey: /api-partner/v1/apps-in-toss/user/oauth2/access/remove-by-user-key

Disconnect login connection with AccessToken

Disconnect login connection with userKey

See

If there are many AccessTokens connected to one userKey readTimeout (3 seconds) may occur. In this case, do not retry the request; try again after some time.

7. Disconnect login via callback

If the user disconnects from the service within the Toss app, we will inform the merchant server. You can use this when the service needs to handle users whose connection has been disconnected. The URL to receive the callback and the basic Auth header can be entered in the console.

Please be sure to check

If the service directly calls the disconnect login API, the callback is not called.

GET method

  • In the request requestParam userKeyand referrerinclude it.

POST method

  • in the request body userKeyand referrerinclude it.

referrer is the disconnect request path.

referrer
Description

UNLINK

It is called when the user disconnects directly in the Toss app. (Path: Toss app → Settings → Authentication and Security → Services logged in with Toss → 'Disconnect')

WITHDRAWAL_TERMS

It is called when the user withdraws consent to the login service terms. (Path: Toss app → Settings → Legal information and others → Terms and privacy policy consent → Consent details by service: "Toss Login" → 'Withdraw consent')

WITHDRAWAL_TOSS

It is called when the user withdraws from Toss membership.

Troubleshooting

When an authentication error occurs during local development

There are mainly two reasons why authentication errors occur when developing locally.

  1. Authentication token expired The previously issued authentication token may have expired. Issue a new token and try again.

  2. Unable to log in as a developer You may not be logged in with a developer account in the sandbox environment. Refer to the sandbox app download, log in, and then try again.

Last updated

Was this helpful?