This document describes how to integrate Kakao Login APIs into your service with the Kakao SDK for iOS.
To learn about each API in detail, refer to Concepts.
For a Kakao Login button, you can download the resources provided by Kakao or customize buttons according to your service user interface by referring to the Design Guide.
According to the Apple's new policy, you must offer account deletion within your app along with account creation. Likewise, if you integrate Kakao Login into your service, you must also provide a function to unlink from your app because users are linked to your app when they log in with Kakao. This applies to the app submission starting January 31, 2022. For more information, refer to App Store Review Guidelines.
The Login with Kakao Talk allows users to move to Kakao Talk from a service app and go back to the app when the user selects [Accept and Continue] or [Cancel] on Kakao Talk. To implement this process, you must configure these things:
handleOpenUrl()
method that asks to open the URL in the AppDelegate.swift file to complete the login process after coming back to the service app.import KakaoSDKAuth
...
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
return AuthController.handleOpenUrl(url: url)
}
return false
}
...
}
import RxKakaoSDKAuth
import KakaoSDKAuth
...
class AppDelegate: UIResponder, UIApplicationDelegate {
...
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
return AuthController.rx.handleOpenUrl(url: url)
}
return false
}
...
}
If you make a project for an app in iOS 13 or higher, UIApplicationSceneManifest
is added in the Info.plist file and UISceneDelegate.swift is set to use as a default. If you use UISceneDelegate.swift, add the handleOpenUrl()
method in the SceneDelegate.swift file, instead of the AppDelegate.swift file.
If you use the SwiftUI App Life Cycle, add handleOpenUrl()
inside the ${PROJECT_NAME}App class using onOpenURL()
in the same way with initializing SDK.
import KakaoSDKAuth
...
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
...
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
_ = AuthController.handleOpenUrl(url: url)
}
}
}
...
}
import RxKakaoSDKAuth
import KakaoSDKAuth
...
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
...
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
if let url = URLContexts.first?.url {
if (AuthApi.isKakaoTalkLoginUrl(url)) {
_ = AuthController.rx.handleOpenUrl(url: url)
}
}
}
...
}
import SwiftUI
import KakaoSDKCommon
import KakaoSDKAuth
...
@main
struct SwiftUI_testApp: App {
...
init() {
// Initialize Kakao SDK.
KakaoSDK.initSDK(appKey: "NATIVE_APP_KEY")
}
var body: some Scene {
WindowGroup {
// Handle Custom URL Scheme using onOpenURL().
ContentView().onOpenURL(perform: { url in
if (AuthApi.isKakaoTalkLoginUrl(url)) {
AuthController.handleOpenUrl(url: url)
}
})
}
}
...
}
Reference | App setting |
---|---|
[SDK, RxSDK] loginWithKakaoTalk() [SDK, RxSDK] loginWithKakaoAccount() [SDK] isKakaoTalkLoginAvailable() [SDK] OAuthToken [SDK] AuthFailureReason |
Install Import modules Initialize Configuration for Login with Kakao Talk |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items Advanced: Activate OpenID Connect(Optional) Set Simple Signup(for Kakao Sync) |
Required | Required: Required consent item |
The Login API enables users to log in through Kakao Talk or their Kakao Account information.
Call isKakaoTalkLoginAvailable()
that invokes loginWithKakaoTalk()
to check if Kakao Talk has been installed on a user's device. loginWithKakaoTalk()
runs Kakao Talk and prompts the Consent screen that asks consent.
To handle exceptions, refer to the AuthFailureReason
section in the reference.
When a user consents, Kakao identifies the user with the user's Kakao Account information linked to Kakao Talk, and then issues tokens. The iOS SDK provides the issued tokens through the OAuthToken
object.
The issued tokens are stored through the TokenManagerProvider
class. The stored tokens are automatically added to the authorization header when calling the token-based APIs.
// Check if Kakao Talk has been installed.
if (UserApi.isKakaoTalkLoginAvailable()) {
UserApi.shared.loginWithKakaoTalk {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoTalk() success.")
// Implement service logics
_ = oauthToken
}
}
}
// Class member property
let disposeBag = DisposeBag()
// Check if Kakao Talk has been installed.
if (UserApi.isKakaoTalkLoginAvailable()) {
UserApi.shared.rx.loginWithKakaoTalk()
.subscribe(onNext:{ (oauthToken) in
print("loginWithKakaoTalk() success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
}
For Login with Kakao Account, call loginWithKakaoAccount()
that runs a web browser and prompts the Consent screen that asks consent.
When a user consents, Kakao identifies the user through the user's Kakao Account cookie stored on the default web browser and then issues tokens through the OAuthToken
class.
UserApi.shared.loginWithKakaoAccount {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.loginWithKakaoAccount()
.subscribe(onNext:{ (oauthToken) in
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
To request additional consent, call loginWithKakaoAccount()
. Pass the scopes of user information you want to request additional consent through scopes
as an array of strings.
Here is an example of checking which scopes are required to get consent with the me()
method and requesting additional consent by passing scopes
when calling loginWithKakaoAccount()
.
UserApi.shared.me() { (user, error) in
if let error = error {
print(error)
}
else {
if let user = user {
//Add the desired scope among the list of all scopes.
var scopes = [String]()
if (user.kakaoAccount?.profileNeedsAgreement == true) { scopes.append("profile") }
if (user.kakaoAccount?.emailNeedsAgreement == true) { scopes.append("account_email") }
if (user.kakaoAccount?.birthdayNeedsAgreement == true) { scopes.append("birthday") }
if (user.kakaoAccount?.birthyearNeedsAgreement == true) { scopes.append("birthyear") }
if (user.kakaoAccount?.genderNeedsAgreement == true) { scopes.append("gender") }
if (user.kakaoAccount?.phoneNumberNeedsAgreement == true) { scopes.append("phone_number") }
if (user.kakaoAccount?.ageRangeNeedsAgreement == true) { scopes.append("age_range") }
if scopes.count > 0 {
// If OpenID Connect (OIDC) is enabled,
// - When "openid" is added to `scopes`, OIDC is applied.
// - When "openid" is not added to `scopes`, OAuth 2.0 is applied.
// To use OIDC, add "openid" to `scopes`.
// scopes.append("openid")
// The tokens are refreshed for the designated scopes.
UserApi.shared.loginWithKakaoAccount(scopes: scopes) { (_, error) in
if let error = error {
print(error)
}
else {
UserApi.shared.me() { (user, error) in
if let error = error {
print(error)
}
else {
print("me() success.")
// Implement service logics
_ = user
}
}
}
}
}
else {
print("Not need to get additional consent.")
}
}
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.me()
.map({ (user) -> User in
//Add the desired scope among the list of all scopes.
var scopes = [String]()
if (user.kakaoAccount?.profileNeedsAgreement == true) { scopes.append("profile") }
if (user.kakaoAccount?.emailNeedsAgreement == true) { scopes.append("account_email") }
if (user.kakaoAccount?.birthdayNeedsAgreement == true) { scopes.append("birthday") }
if (user.kakaoAccount?.birthyearNeedsAgreement == true) { scopes.append("birthyear") }
if (user.kakaoAccount?.genderNeedsAgreement == true) { scopes.append("gender") }
if (user.kakaoAccount?.phoneNumberNeedsAgreement == true) { scopes.append("phone_number") }
if (user.kakaoAccount?.ageRangeNeedsAgreement == true) { scopes.append("age_range") }
if (scopes.count > 0) {
// If OpenID Connect (OIDC) is enabled,
// - When "openid" is added to `scopes`, OIDC is applied.
// - When "openid" is not added to `scopes`, OAuth 2.0 is applied.
// To use OIDC, add "openid" to `scopes`.
// scopes.append("openid")
throw SdkError(scopes:scopes)
}
else {
return user
}
})
.retry(when: Auth.shared.rx.incrementalAuthorizationRequired())
.subscribe(onSuccess:{ ( user ) in
print("me() success.")
// Implement service logics
_ = user
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
This API is only allowed for the service that adopted Kakao Sync.
To request consent to specific service terms from a user, pass the list of service term tags through serviceTerms
as an argument. Include at least one required service term's tag to prompt the consent screen.
// Add service_terms in a string format that includes all service terms separated by ‘,’
// ex) "tag1,tag2"
let serviceTerms = ["tag1", "tag2"]
UserApi.shared.loginWithKakaoAccount(serviceTerms: serviceTerms, completion: {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoAccount(serviceTerms:) success.")
// Implement service logics
_ = oauthToken
}
})
// Class member property
let disposeBag = DisposeBag()
// Add service_terms in a string format that includes all service terms separated by ‘,’
// ex) "tag1,tag2"
let serviceTerms = ["tag1", "tag2"]
UserApi.shared.rx.loginWithKakaoAccount(serviceTerms: serviceTerms)
.subscribe(onNext: { (oauthToken) in
print("loginWithKakaoAccount(serviceTerms:) success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
You can request reauthentication regardless of a user's login status to enhance security. Set prompts
to .LOGIN
, and pass it when calling loginWithKakaoAccount()
. Then, the login screen is prompted even though a user has already been logged in on the same web browser on the device.
UserApi.shared.loginWithKakaoAccount(prompts:[.Login]) {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.loginWithKakaoAccount(prompts: [.Login])
.subscribe(onNext:{ (oauthToken) in
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
You can request to prompt the Kakao Account sign-up page before Kakao Login. Set prompts
to .Create
, and pass it when calling loginWithKakaoAccount()
. The Kakao Login consent screen will be present after signing up for Kakao Account.
UserApi.shared.loginWithKakaoAccount(prompts:[.Create]) {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.loginWithKakaoAccount(prompts: [.Create])
.subscribe(onNext:{ (oauthToken) in
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
To fill in the ID automatically, use the loginHint
parameter. The value of the loginHint
parameter will be entered in the Kakao Account login page.
UserApi.shared.loginWithKakaoAccount (loginHint: "${HINT}") {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.loginWithKakaoAccount(loginHint: "${HINT}")
.subscribe(onNext:{ (oauthToken) in
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
To request Kakao Account easy login, set the prompt
parameter to SelectAccount
.
UserApi.shared.loginWithKakaoAccount(prompts:[.SelectAccount]) {(oauthToken, error) in
if let error = error {
print(error)
}
else {
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.loginWithKakaoAccount(prompts: [.SelectAccount])
.subscribe(onNext:{ (oauthToken) in
print("loginWithKakaoAccount() success.")
// Implement service logics
_ = oauthToken
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK] hasToken() |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login |
Required | - |
Checks if a user has obtained an access token through Kakao Login.
Call hasToken()
.
This API returns the presence of an access token or refresh token as a boolean type. However, note that the return value true
does not guarantee that the user is in a logged-in state.
If the value false
is returned, it means that a token does not exist. In this case, implement a process for a user to log in to issue a token. On the other hand, if the return value is true
, you can validate the access token that the user has through the accessTokenInfo()
method in UserApi
, and then proceed as follows depending on the request result:
if (AuthApi.hasToken()) {
UserApi.shared.accessTokenInfo { (_, error) in
if let error = error {
if let sdkError = error as? SdkError, sdkError.isInvalidTokenError() == true {
//Login is required.
}
else {
//Handle other errors.
}
}
else {
//Succeeded in validating token (Token is refreshed if needed).
}
}
}
else {
//Login is required.
}
// Class member property
let disposeBag = DisposeBag()
if (AuthApi.hasToken()) {
UserApi.shared.rx.accessTokenInfo()
.subscribe(onSuccess:{ (_) in
//Succeeded in validating token (Token is refreshed if needed).
}, onFailure: {error in
if let sdkError = error as? SdkError, sdkError.isInvalidTokenError() == true {
//Login is required.
}
else {
//Handle other errors.
}
})
.disposed(by: disposeBag)
}
else {
//Login is required.
}
Reference | App setting |
---|---|
[SDK, RxSDK] logout() |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login |
Required | - |
Makes the issued access token and the refresh token expire.
Call logout()
.
Regardless of the result of the logout request, the iOS SDK deletes the access and refresh tokens and has the login session end.
UserApi.shared.logout {(error) in
if let error = error {
print(error)
}
else {
print("logout() success.")
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.logout()
.subscribe(onCompleted:{
print("logout() success.")
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] unlink() |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login |
Required | - |
Unlinks the user and the service app.
Call unlink()
.
If the request is successful, the iOS SDK deletes the access and refresh tokens. As the issued tokens are deleted, the session between an app and a user is disconnected, and the user is logged out and unlinked from your app.
UserApi.shared.unlink {(error) in
if let error = error {
print(error)
}
else {
print("unlink() success.")
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.unlink()
.subscribe(onCompleted:{
print("unlink() success.")
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] accessTokenInfo() [SDK] AccessTokenInfo |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login |
Required | - |
Retrieves the validity period of the access and refresh tokens in seconds, app ID and service user ID.
Call accessTokenInfo()
.
Refer to REST API for detailed response information.
// Retrieve the expiration time of the access token.
UserApi.shared.accessTokenInfo {(accessTokenInfo, error) in
if let error = error {
print(error)
}
else {
print("accessTokenInfo() success.")
// Implement service logics
_ = accessTokenInfo
}
}
// Class member property
let disposeBag = DisposeBag()
// Retrieve the expiration time of the access token.
UserApi.shared.rx.accessTokenInfo()
.subscribe(onSuccess:{ (accessTokenInfo) in
print("accessTokenInfo() success.")
// Implement service logics
_ = accessTokenInfo
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] me() [SDK] User |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items |
Required | Required: All consent items to request user information |
Retrieves Kakao Account information of a user who is logged into Kakao.
Call me()
.
The user information in response to this request is passed to the User
class. For example, you can access user.id
to retrieve Service user ID, user.kakaoAccount.profile
for Kakao Account's profile information, user.kakaoAccount.email
for email.
Refer to REST API for detailed response information.
UserApi.shared.me() {(user, error) in
if let error = error {
print(error)
}
else {
print("me() success.")
// Implement service logics
_ = user
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.me()
.subscribe (onSuccess:{ user in
print("me() success.")
// Implement service logics
_ = user
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] updateProfile() |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage user properties |
Required | - |
Stores or updates additional user information on the Kakao platform to use in a service, which is called 'User properties'. You can store or update additional user information into the user property keys that you designated in [My Application] > [Kakao Login] > [User Properties].
Call updateProfile()
. You must pass the custom property keys and values that you want to upadate through properties
in a key-value pair. For example, if you want to update a user's clothing size, set properties
to ["clothing_size":"small"]
.
The response includes the service user ID.
UserApi.shared.updateProfile(properties: ["${CUSTOM_PROPERTY_KEY}":"${CUSTOM_PROPERTY_VALUE}"]) {(error) in
if let error = error {
print(error)
}
else {
print("updateProfile() success.")
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.updateProfile(properties:["${CUSTOM_PROPERTY_KEY}":"${CUSTOM_PROPERTY_VALUE}"])
.subscribe(onCompleted:{
print("updateProfile() success.")
}, onError: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] selectShippingAddresses() [SDK, RxSDK] shippingAddresses() [SDK] UserShippingAddresses |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required | Register platforms Activate Kakao Login Manage consent items |
Required | Required: Shipping information |
Prompts the shipping address picker to allow users to select a shipping address and returns the selected shipping address ID.
Call shippingAddresses()
.
This API returns an addressId
for the selected shipping address. Request Retrieve shipping address with the addressId
to get the detailed shipping address.
Refer to Troubleshooting for the error cause.
// Select shipping address
UserApi.shared.selectShippingAddress { (addressId, error) in
if let error = error {
print(error)
} else {
// Retrieve shipping address
if let addressId = addressId {
UserApi.shared.shippingAddresses(addressId: addressId) { (shippingAddress, error) in
if let error = error {
print(error)
} else {
print(shippingAddress)
}
}
}
}
}
let disposeBag = DisposeBag()
// Select shipping address
UserApi.shared.rx.selectShippingAddress()
.flatMap({ addressId in
// Retrieve shipping address
UserApi.shared.rx.shippingAddresses(addressId: addressId)
})
.subscribe { shippingAddress in
print(shippingAddress)
} onFailure: { error in
print(error)
}
.disposed(by: disposeBag)
Retrieves shipping addresses saved in the user's Kakao Account.
Call shippingAddresses()
in UserApi
.
Specify the address ID to the addressId
parameter.
shippingAddresses()
returns the UserShippingAddresses
object.
If not using Select shipping address API, the response may not include the shipping address when the user did not consent to the [Shipping information]. Refer to No shipping address in the response.
Refer to Troubleshooting for the error cause.
UserApi.shared.shippingAddresses {(shippingAddress, error) in
if let error = error {
print(error)
}
else {
print("shippingAddresses() success.")
// Implement service logics
_ = shippingAddress
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.shippingAddresses()
.subscribe(onSuccess:{ (shippingAddress) in
print("shippingAddresses() success.")
// Implement service logics
_ = shippingAddress
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] scopes() |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items |
Required | - |
Retrieves the detailed information of the scopes (consent items) that a user has agreed to. You can check all scopes set in [My Application] > [Kakao Login] > [Consent Items] and the details of the scopes. If a user has consented to the scope before, the scope is included in the response even though your app is currently not using the scope.
Call scopes()
.
If the request is successful, scopes()
returns the ScopeInfo
object.
Refer to REST API for detailed response information.
UserApi.shared.scopes() { (scopeInfo, error) in
if let error = error {
self?.errorHandler(error: error)
}
else {
self?.success(scopeInfo)
// Implement service logics
_ = scopeInfo
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.scopes()
.subscribe(onSuccess:{ (scopeInfo) in
self.success(scopeInfo)
// Implement service logics
_ = scopeInfo
}, onFailure: {error in
self.errorHandler(error: error)
})
.disposed(by: self.disposeBag)
You can also retrieve the information of specific scopes by passing scope IDs. In this case, the response includes only the detailed information of the specified scopes if the request is successful.
UserApi.shared.scopes(scopes: ["account_email","gender"]) { (scopeInfo, error) in
if let error = error {
self?.errorHandler(error: error)
}
else {
self?.success(scopeInfo)
// Implement service logics
_ = scopeInfo
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.scopes(scopes: ["account_email","gender"])
.subscribe(onSuccess:{ (scopeInfo) in
self.success(scopeInfo)
// Implement service logics
_ = scopeInfo
}, onFailure: {error in
self.errorHandler(error: error)
})
.disposed(by: self.disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] revokeScopes() [SDK] ScopeInfo |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
- | Register platforms Activate Kakao Login Manage consent items |
Required | - |
Revokes the scope that a user has agreed to. You can only revoke the scope with "revocable
is true
. If you request to revoke the scope that is not revocable, an error is returned.
Call revokeScopes()
. You must pass the list of scope ID through the scopes
parameter when calling revokeScopes()
.
If the request is successful, scopes()
returns the ScopeInfo
object that includes the details of each scope and whether a user has agreed to the scope.
UserApi.shared.revokeScopes(scopes: ["account_email","gender"]) { (scopeInfo, error) in
if let error = error {
self?.errorHandler(error: error)
}
else {
self?.success(scopeInfo)
// Implement service logics
_ = scopeInfo
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.revokeScopes(scopes: ["account_email","gender"])
.subscribe(onSuccess:{ (scopeInfo) in
self.success(scopeInfo)
// Implement service logics
_ = scopeInfo
}, onFailure: {error in
self.errorHandler(error: error)
})
.disposed(by: self.disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] serviceTerms() [SDK, RxSDK] revokeServiceTerms() [SDK] UserServiceTerms [SDK] ServiceTerms [SDK] UserRevokedServiceTerms [SDK] RevokedServiceTerms |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required: Kakao Sync | Register platforms Activate Kakao Login Manage consent items Set Simple Signup |
Required | - |
This API is only allowed for the service that adopted Kakao Sync.
Checks the service terms that a user has consented to.
Call serviceTerms()
.
serviceTerms()
returns the UserServiceTerms
object.
Refer to REST API for detailed response information.
UserApi.shared.serviceTerms() { (userServiceTerms, error) in
if let error = error {
self?.errorHandler(error: error)
}
else {
self?.success(userServiceTerms)
// Implement service logics
_ = userServiceTerms
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.serviceTerms()
.subscribe(onSuccess:{ (userServiceTerms) in
self.success(userServiceTerms)
// Implement service logics
_ = userServiceTerms
}, onFailure: {error in
self.errorHandler(error: error)
})
.disposed(by: self.disposeBag)
Revoke a service terms that a specific user has agreed to. Only service terms with a revocable
value of true
in the Retrieve consent details for service terms response can be revoked.
Call revokeServiceTerms()
. Specify the tags of the service terms you want to revoke consent for in tags
.
revokeServiceTerms()
returns the UserRevokedServiceTerms
object.
Refer to REST API for detailed response information.
UserApi.shared.revokeServiceTerms(tags: ["test_tag1","test_tag2"]) { (userRevokedServiceTerms, error) in
if let error = error {
self?.errorHandler(error: error)
}
else {
self?.success(userRevokedServiceTerms)
// Implement service logics
_ = userRevokedServiceTerms
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.revokeServiceTerms(tags: ["test_tag1", "test_tag2"])
.subscribe(onSuccess:{ (userRevokedServiceTerms) in
self.success(userRevokedServiceTerms)
// Implement service logics
_ = userRevokedServiceTerms
}, onFailure: {error in
self.errorHandler(error: error)
})
.disposed(by: self.disposeBag)
Reference | App setting |
---|---|
[SDK, RxSDK] signup() |
Install Import modules Initialize |
Permission | Prerequisite | Kakao Login | User consent |
---|---|---|---|
Required | Register platforms Activate Kakao Login |
Required | - |
The Manual signup API is only for the app with the Auto-link option disabled. Before using this API, check out when to use this API and the cautions in REST API.
The Manual signup API manually links a user with your app to complete signup when the Auto-link is disabled.
To figure out if the currently logged-in user needs to be linked with your app, check the value of hasSignedUp
in the response of the Retrieving user information API and handle each case:
true
: The user is already linked with your app. You do not need to call the Manual signup API.false
: The user is not linked with your app. You must call signup()
to link the user with your app manually.nil
: Your app is using the Auto-link feature. You do not need to call the Manual signup API.If the return value of hasSignedUp
is false
and the user is ready to sign up, call signup()
to complete the signup.
If the request is successful, the user's service ID is returned.
To check the request result, request the Retrieving user information API again and check the value of hasSignedUp
because the user's linked status is not provided even when the request is successful.
UserApi.shared.signup { (userId, error) in
if let error = error {
print(error)
}
else {
print("signup() success.")
}
}
// Class member property
let disposeBag = DisposeBag()
UserApi.shared.rx.signup()
.subscribe (onSuccess:{ (userId) in
print("signup() success.")
}, onFailure: {error in
print(error)
})
.disposed(by: disposeBag)
If you want to store the user's information when the user is linked to your app, pass properties
.