์ ํ (apple
)
๐ ์ต์ ํ ์ผ์: 2025-02-10
๊ฐ์โ
apple
๋ค์์คํ์ด์ค๋ ๋๋ฐ์ด์ค์ Apple ๋ค์ดํฐ๋ธ ๊ธฐ๋ฅ์ ํ์ฉํ ์ ์๋๋ก ์ง์ํฉ๋๋ค.
ํ์ฌ๋ Apple ๋ก๊ทธ์ธ ๋ฐ ์ฌ์ฉ์ ์ ๋ณด ์กฐํ ๊ธฐ๋ฅ์ ์ ๊ณตํฉ๋๋ค.
โ ๏ธ ์ด ๋ค์์คํ์ด์ค๋ ํ์ฌ iOS์์๋ง ์ง์๋ฉ๋๋ค.
ํ์ ์ ์โ
AppleResult
โ
Apple ๋ก๊ทธ์ธ ์ ์ฒญ์ ๊ฒฐ๊ณผ ์ํ๋ฅผ ๋ํ๋ด๋ ๊ฐ์ฒด ํ์ ์ ๋๋ค.
ํ๋ | ํ์ | ์ค๋ช |
---|---|---|
status | string | ์์ฒญ ๊ฒฐ๊ณผ ์ํ (success / error ) |
errorCode (optional) | string | ์ค๋ฅ ์ฝ๋ (์ ํ์ ) |
message (optional) | string | ์ค๋ฅ ๋ฉ์์ง (์ ํ์ ) |
ApplePermissionTypes
โ
Apple ๋ก๊ทธ์ธ ์์ฒญ ์ ์๊ตฌํ ์ ์๋ ๊ถํ ๋ชฉ๋ก์ ๋๋ค.
๊ฐ | ์ค๋ช |
---|---|
email | ์ฌ์ฉ์ ์ด๋ฉ์ผ ์ ๋ณด |
fullName | ์ฌ์ฉ์ ์ ์ฒด ์ด๋ฆ ์ ๋ณด |
AppleUserData
โ
Apple ๋ก๊ทธ์ธ ์ฑ๊ณต ์ ๋ฐํ๋๋ ์ฌ์ฉ์ ์ ๋ณด ๊ฐ์ฒด์ ๋๋ค.
ํ๋ | ํ์ | ์ค๋ช |
---|---|---|
identifier | string | Apple ์ฌ์ฉ์ ๊ณ ์ ์๋ณ์ |
token | string | ์ฌ์ฉ์ ํ ํฐ |
authorizationCode | string | Apple ์ธ์ฆ ์ฝ๋ |
email (optional) | string | ์ฌ์ฉ์ ์ด๋ฉ์ผ (์ ํ์ ) |
name.familyName (optional) | string | ์ฌ์ฉ์ ์ฑ |
name.givenName (optional) | string | ์ฌ์ฉ์ ์ด๋ฆ |
[fields: string] | any | ๊ธฐํ ์ฌ์ฉ์ ๋ฐ์ดํฐ (์ ํ์ ) |
๋ฉ์๋ ๋ชฉ๋กโ
๋ฉ์๋ | ์ค๋ช | ์ถ๊ฐ๋ ๋ฒ์ |
---|---|---|
login(permissions, callback) | Apple ๋ค์ดํฐ๋ธ ์์ ๋ก๊ทธ์ธ์ ์ํํฉ๋๋ค. | ver.1.4.0 |
isLoggedIn(identifier, callback) | Apple ๋ก๊ทธ์ธ ์ํ๋ฅผ ํ์ธํฉ๋๋ค. | ver.1.4.0 |
getUserIdentifier(callback) | Apple ์ฌ์ฉ์ ๊ณ ์ ์๋ณ์๋ฅผ ๋ฐํํฉ๋๋ค. | ver.1.4.0 |
๋ฉ์๋ ์์ธโ
login(permissions: ApplePermissions, callback: (result: AppleResult, userData?: AppleUserData) => any): void
โ
- since ver.1.4.0
์ค๋ช
(login
)โ
Apple ๋ค์ดํฐ๋ธ ์์ ๋ก๊ทธ์ธ์ ์ํํ๊ณ ์ฌ์ฉ์ ์ ๋ณด๋ฅผ ๋ฐํํฉ๋๋ค.
๋งค๊ฐ๋ณ์ (login
)โ
์ด๋ฆ | ํ์ | ํ์ ์ฌ๋ถ | ์ค๋ช |
---|---|---|---|
permissions | ApplePermissions | โ | ๋ก๊ทธ์ธ ์์ฒญ ์ ์๊ตฌํ ๊ถํ ๋ชฉ๋ก |
callback | (result: AppleResult, userData?: AppleUserData) => any | โ | ์์ฒญ ๊ฒฐ๊ณผ์ ์ฌ์ฉ์ ์ ๋ณด๋ฅผ ๋ฐํํ๋ ํจ์ |
๋ฐํ ๊ฐ (login
)โ
ํด๋น ๋ฉ์๋๋ ๋ฐํ ๊ฐ์ ๊ฐ์ง์ง ์์ผ๋ฉฐ, ๊ฒฐ๊ณผ๋ callback
์ ํตํด ๋น๋๊ธฐ์ ์ผ๋ก ์ ๊ณต๋ฉ๋๋ค.
์ฌ์ฉ ์์ (login
)โ
// Apple ๋ก๊ทธ์ธ ์์ฒญ
Nachocode.apple.login(['email', 'fullName'], (result, userData) => {
if (result.status === 'success') {
console.log('Apple ๋ก๊ทธ์ธ ์ฑ๊ณต:', userData);
console.log('ํ ํฐ:', userData.token);
console.log('์ธ๊ฐ์ฝ๋:', userData.authorizationCode);
console.log('์ด๋ฉ์ผ:', userData.email);
console.log('์ฑ:', userData.name?.familyName);
console.log('์ด๋ฆ:', userData.name?.givenName);
} else {
console.error(`Apple ๋ก๊ทธ์ธ ์คํจ: ${result.message}`);
}
});
isLoggedIn(identifier: string, callback: (result: AppleResult, isLoggedIn: boolean) => any): void
โ
- since ver.1.4.0
์ค๋ช
(isLoggedIn
)โ
Apple ์ฌ์ฉ์ ๊ณ ์ ์๋ณ์(identifier
)๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ํ์ฌ ์ฌ์ฉ์๊ฐ ๋ก๊ทธ์ธ ์ํ์ธ์ง ํ์ธํฉ๋๋ค.
๋งค๊ฐ๋ณ์ (isLoggedIn
)โ
์ด๋ฆ | ํ์ | ํ์ ์ฌ๋ถ | ์ค๋ช |
---|---|---|---|
identifier | string | โ | Apple ์ฌ์ฉ์ ๊ณ ์ ์๋ณ์ |
callback | (result: AppleResult, isLoggedIn: boolean) => any | โ | ๋ก๊ทธ์ธ ์ฌ๋ถ๋ฅผ ๋ฐํํ๋ ํจ์ |
๋ฐํ ๊ฐ (isLoggedIn
)โ
ํด๋น ๋ฉ์๋๋ ๋ฐํ ๊ฐ์ ๊ฐ์ง์ง ์์ผ๋ฉฐ, ๊ฒฐ๊ณผ๋ callback
์ ํตํด ๋น๋๊ธฐ์ ์ผ๋ก ์ ๊ณต๋ฉ๋๋ค.
์ฌ์ฉ ์์ (isLoggedIn
)โ
// Apple ๋ก๊ทธ์ธ ์ํ ํ์ธ
Nachocode.apple.isLoggedIn('user_identifier_here', (result, isLoggedIn) => {
console.log('์กฐํ ์ฑ๊ณต ์ฌ๋ถ:', result.status);
if (isLoggedIn) {
console.log('์ฌ์ฉ์๋ ํ์ฌ Apple์ ๋ก๊ทธ์ธ๋์ด ์์ต๋๋ค.');
} else {
console.log('Apple ๋ก๊ทธ์ธ์ด ๋์ด ์์ง ์์ต๋๋ค.');
}
});
getUserIdentifier(callback: (result: AppleResult, userIdentifier?: string) => any): void
โ
- since ver.1.4.0
์ค๋ช
(getUserIdentifier
)โ
Apple ์ฌ์ฉ์ ๊ณ ์ ์๋ณ์๋ฅผ ๋ฐํํฉ๋๋ค.
๋งค๊ฐ๋ณ์ (getUserIdentifier
)โ
์ด๋ฆ | ํ์ | ํ์ ์ฌ๋ถ | ์ค๋ช |
---|---|---|---|
callback | (result: AppleResult, userIdentifier?: string) => any | โ | Apple ์ฌ์ฉ์ ์๋ณ์๋ฅผ ๋ฐํํ๋ ํจ์ |
๋ฐํ ๊ฐ (getUserIdentifier
)โ
ํด๋น ๋ฉ์๋๋ ๋ฐํ ๊ฐ์ ๊ฐ์ง์ง ์์ผ๋ฉฐ, ๊ฒฐ๊ณผ๋ callback
์ ํตํด ๋น๋๊ธฐ์ ์ผ๋ก ์ ๊ณต๋ฉ๋๋ค.
์ฌ์ฉ ์์ (getUserIdentifier
)โ
// Apple ์ฌ์ฉ์ ๊ณ ์ ์๋ณ์ ์กฐํ
Nachocode.apple.getUserIdentifier((result, userIdentifier) => {
if (result.status === 'success') {
console.log(`์ฌ์ฉ์ ์๋ณ์: ${userIdentifier}`);
} else {
console.error(`์ฌ์ฉ์ ์๋ณ์ ์กฐํ ์คํจ: ${result.message}`);
}
});
์ถ๊ฐ ์ ๋ณดโ
- Apple ๋ค์์คํ์ด์ค๋ ํ์ฌ iOS์์๋ง ๋์ํฉ๋๋ค. Android ๋ฐ ๊ธฐํ ํ๊ฒฝ์์๋ ์ถํ ์ง์๋ ์์ ์ ๋๋ค.
- ์ฌ์ฉ์์ ์ด๋ฉ์ผ ๋ฐ ์ด๋ฆ ์ ๋ณด๋ ์ต์ด ๋ก๊ทธ์ธ ์์๋ง ์ ๊ณต๋ ์ ์์ผ๋ฉฐ, ์ดํ ์ฌ๋ก๊ทธ์ธ ์ ๋ฐํ๋์ง ์์ ์ ์์ต๋๋ค.