토스 로그인 연동 확인
지원환경: React NativeReact Native SDKv1.4.9WebViewWebView SDKv1.4.9
실행환경: Toss App최소버전v5.237.0Sandbox App
getIsTossLoginIntegratedService
getIsTossLoginIntegratedService 함수는 해당 유저가 토스 로그인에 연동된 유저인지 식별하는 값을 반환해요.
토스 로그인에서 게임 로그인으로의 마이그레이션 과정에 사용돼요.
시그니처
tsx
function getIsTossLoginIntegratedService(): Promise<boolean>| 반환 타입 | 설명 |
|---|---|
Promise<boolean> | 현재 서비스가 토스 로그인과 연동되어 있다면 true, 아니면 false를 반환합니다. |
예제
js
import { getIsTossLoginIntegratedService } from '@apps-in-toss/web-framework';
async function handleGetIsTossLoginIntegratedService() {
try {
const result = await getIsTossLoginIntegratedService();
if (result === undefined) {
console.warn('지원하지 않는 앱 버전이에요.');
return;
}
if (result === true) {
console.log('토스 로그인이 연동된 유저에요.');
// 여기에서 토스 로그인 연동 유저에 대한 처리를 할 수 있어요.
}
if (result === false) {
console.log('토스 로그인이 연동되지 않은 유저에요.');
// 여기에서 토스 로그인 연동 유저가 아닌 경우에 대한 처리를 할 수 있어요.
}
} catch (error) {
console.error(error);
}
}tsx
import { getIsTossLoginIntegratedService } from '@apps-in-toss/web-framework';
function GetIsTossLoginIntegratedServiceButton() {
async function handleClick() {
try {
const result = await getIsTossLoginIntegratedService();
if (result === undefined) {
console.warn('지원하지 않는 앱 버전이에요.');
return;
}
if (result === true) {
console.log('토스 로그인이 연동된 유저에요.');
// 여기에서 토스 로그인 연동 유저에 대한 처리를 할 수 있어요.
}
if (result === false) {
console.log('토스 로그인이 연동되지 않은 유저에요.');
// 여기에서 토스 로그인 연동 유저가 아닌 경우에 대한 처리를 할 수 있어요.
}
} catch (error) {
console.error(error);
}
}
return (
<button onClick={handleClick}>토스 로그인 통합 서비스 여부 확인</button>
);
}tsx
import { Button } from 'react-native';
import { getIsTossLoginIntegratedService } from '@apps-in-toss/framework';
function GetIsTossLoginIntegratedServiceButton() {
async function handlePress() {
try {
const result = await getIsTossLoginIntegratedService();
if (result === undefined) {
console.warn('지원하지 않는 앱 버전이에요.');
return;
}
if (result === true) {
console.log('토스 로그인이 연동된 유저에요.');
// 여기에서 토스 로그인 연동 유저에 대한 처리를 할 수 있어요.
}
if (result === false) {
console.log('토스 로그인이 연동되지 않은 유저에요.');
// 여기에서 토스 로그인 연동 유저가 아닌 경우에 대한 처리를 할 수 있어요.
}
} catch (error) {
console.error(error);
}
}
return (
<Button onPress={handlePress} title="토스 로그인 통합 서비스 여부 확인" />
);
}토스 로그인을 사용하지 않는 미니앱에서 getIsTossLoginIntegratedService()를 호출하면
아래 예외가 발생할 수 있어요.
tsx
@throw {message: "oauth2ClientId 설정이 필요합니다."}