Consent Scope Information
These APIs retrieve and revoke user consent.
For more details, refer to the Official Documentation.
Get Consent Information
Use scopes(scopes?: string[]) to retrieve user consent items.
Pass scope IDs to request only those items on Android, iOS, and web. Omit the argument or pass an empty array to request all items. A successful response without a list returns an empty array.
The response type is Promise<KakaoScopeInfo[]>.
export type KakaoScopeInfo = {
id: string;
agreed: boolean;
displayName: string;
revocable?: boolean | null;
using: boolean;
delegated?: boolean | null;
type: string;
};
Example
await scopes(['profile_nickname']);
Revoke Consent
You can revoke user consent items using revokeScopes(scopes: string[]).
Revokes the consent for the agreed items by the user. Only consent items with a revocable value of true in the consent item information obtained through the consent information retrieval API can be revoked. If you request to revoke consent for items where revocation is not possible, you will receive an error response.
The ID of the consent item to be revoked is specified as the
scopesvalue, referring to the ID in[My Applications] > [Kakao Login] > [Consent Items].
Example
await revokeScopes(['account_email']);
revokeScopes() returns Promise<void> and resolves to undefined after revocation. Use revokeScopesWithResult() when you need the consent items returned by the SDK immediately after revocation. Both functions change the user's actual consent state.
import { revokeScopesWithResult } from '@react-native-kakao/user';
const currentScopes = await revokeScopesWithResult(['account_email']);
It returns Promise<KakaoScopeInfo[]>, or an empty array when the response omits the list. Revoking the example's account_email requires its queried revocable value to be true. Both methods reject on authentication errors or scopes that cannot be revoked.