Auth

Kakao. Auth

사용자 인증과 관련된 함수들이 포함되어 있습니다.

Methods

(static) authorize(settings)

See:

사용자가 앱에 로그인할 수 있도록 인가 코드를 요청하는 함수입니다. 인가 코드를 받을 수 있는 서버 개발이 필요합니다.

Parameters:
Name Type Description
settings Object

인가 코드 요청과 관련된 설정을 key/value로 전달합니다.

Properties
Name Type Attributes Default Description
redirectUri String <optional>

인가 코드를 받을 URI

state String <optional>

인가 코드 요청과 응답 과정에서 유지할 수 있는 파라미터

scope String <optional>

추가 동의 받을 항목의 키 ex) "account_email,gender"

throughTalk Boolean <optional>
true

간편 로그인 사용 여부

prompts String <optional>

인가 코드 요청 시 추가 상호작용을 요청하고자 할 때 전달하는 파라미터 ex) "cert": 인증 로그인, "login": 다른 계정으로 로그인

(static) cleanup()

로그인 버튼을 생성하기 위해 삽입한 iframe을 삭제하고 리소스를 해제합니다.

(static) createLoginButton(settings)

See:
  • Kakao.Auth.login 직접 로그인 버튼을 제작하여 사용할 때 이용하세요.

카카오 로그인 버튼을 생성합니다.

Parameters:
Name Type Description
settings Object

로그인 버튼과 관련된 설정을 key/value로 전달합니다.

Properties
Name Type Attributes Default Description
container String | HTMLElement

DOM Element 또는 Element의 ID Selector를 넘기면, 해당 Element 내부에 로그인 버튼이 생성됩니다.

lang String <optional>
"kr"

로그인 버튼에 표시할 언어, "kr"|"en"

size String <optional>
"medium"

로그인 버튼의 사이즈, "small"|"medium"|"large"

success AuthSuccessCallback <optional>

로그인이 성공할 경우 토큰을 받을 콜백 함수

fail AuthFailCallback <optional>

로그인이 실패할 경우 에러를 받을 콜백 함수

always AuthSuccessCallback | AuthFailCallback <optional>

로그인 성공 여부에 관계 없이 항상 호출되는 함수

scope String <optional>

추가 동의 받을 항목의 키 ex) "account_email,gender"

persistAccessToken Boolean <optional>
true

세션이 종료된 뒤에도 액세스 토큰을 사용할 수 있도록 로컬 스토리지 저장 여부

throughTalk Boolean <optional>
true

간편 로그인 사용 여부

(static) getAccessToken() → {String}

Returns:

사용 중인 액세스 토큰

Type
String

(static) getAppKey() → {String}

Returns:

사용중인 App Key

Type
String

(static) getRefreshToken()

Deprecated:
  • 이 API는 보안 정책으로 인해 폐기되었습니다.

(static) getStatusInfo(callbackopt)

현재 로그인 상태를 반환합니다.

Parameters:
Name Type Attributes Description
callback AuthStatusCallback <optional>

로그인 상태를 받을 콜백 함수

(static) login(settings)

See:

사용자가 앱에 로그인할 수 있도록 로그인 팝업창을 띄우는 함수입니다. 사용자의 클릭 이벤트 이후에 호출되어야 브라우저에 의해 팝업이 차단되지 않습니다.

Parameters:
Name Type Description
settings Object

로그인과 관련된 설정을 key/value로 전달합니다.

Properties
Name Type Attributes Default Description
success AuthSuccessCallback <optional>

로그인이 성공할 경우 토큰을 받을 콜백 함수

fail AuthFailCallback <optional>

로그인이 실패할 경우 에러를 받을 콜백 함수

always AuthSuccessCallback | AuthFailCallback <optional>

로그인 성공 여부에 관계 없이 항상 호출되는 함수

scope String <optional>

추가 동의 받을 항목의 키 ex) "account_email,gender"

persistAccessToken Boolean <optional>
true

세션이 종료된 뒤에도 액세스 토큰을 사용할 수 있도록 로컬 스토리지 저장 여부

throughTalk Boolean <optional>
true

간편 로그인 사용 여부

(static) loginForm(settings)

See:

다른 계정으로 로그인할 수 있도록 로그인 팝업창을 띄우는 함수입니다. 사용자의 클릭 이벤트 이후에 호출되어야 브라우저에 의해 팝업이 차단되지 않습니다.

Parameters:
Name Type Description
settings Object

로그인과 관련된 설정을 key/value로 전달합니다.

Properties
Name Type Attributes Default Description
success AuthSuccessCallback <optional>

로그인이 성공할 경우 토큰을 받을 콜백 함수

fail AuthFailCallback <optional>

로그인이 실패할 경우 에러를 받을 콜백 함수

always AuthSuccessCallback | AuthFailCallback <optional>

로그인 성공 여부에 관계 없이 항상 호출되는 함수

scope String <optional>

추가 동의 받을 항목의 키 ex) "account_email,gender"

persistAccessToken Boolean <optional>
true

세션이 종료된 뒤에도 액세스 토큰을 사용할 수 있도록 로컬 스토리지 저장 여부

(static) logout(callbackopt)

See:

현재 로그인되어 있는 사용자를 로그아웃시키고, Access Token을 삭제합니다.

Parameters:
Name Type Attributes Description
callback function <optional>

로그아웃 후 호출할 콜백 함수

(static) setAccessToken(token, persistopt)

API 호출 시 사용할 액세스 토큰을 설정합니다.

Parameters:
Name Type Attributes Default Description
token String

사용할 액세스 토큰

persist Boolean <optional>
true

세션이 종료된 뒤에도 액세스 토큰을 사용할 수 있도록 로컬 스토리지 저장 여부

(static) setRefreshToken()

Deprecated:
  • 이 API는 보안 정책으로 인해 폐기되었습니다.

Type Definitions

AuthFailCallback(errorObj)

Parameters:
Name Type Description
errorObj Object
Properties
Name Type Description
error String

고정값 "access_denied"

error_description String

AuthStatusCallback(statusObj)

Parameters:
Name Type Description
statusObj Object
Properties
Name Type Description
status String

"connected" 또는 "not_connected"

user Object

로그인 상태일 때만 전달되는 사용자 정보

AuthSuccessCallback(authObj)

Parameters:
Name Type Description
authObj Object
Properties
Name Type Description
access_token String
refresh_token String
token_type String

고정값 "bearer"

expires_in Number
scope String