requestToken appBridge
This commit is contained in:
@@ -8,13 +8,13 @@ export interface MenuGrantsItem {
|
||||
grant: number;
|
||||
};
|
||||
export interface LoginResponse {
|
||||
usrid?: string;
|
||||
tokenType?: string;
|
||||
accessToken?: string;
|
||||
refreshToken?: string;
|
||||
accessTokenExpiresIn?: number;
|
||||
refreshTokenExpiresIn?: number;
|
||||
menuGrants?: Array<MenuGrantsItem>;
|
||||
// usrid?: string;
|
||||
clientAddressIP?: string;
|
||||
tempToken?: string,
|
||||
tempTokenExpiresIn?: number;
|
||||
|
||||
@@ -38,6 +38,12 @@ interface UseAppBridgeReturn {
|
||||
// 공유
|
||||
shareContent: (content: ShareContent) => Promise<void>;
|
||||
|
||||
// 로그아웃
|
||||
logout: () => Promise<void>;
|
||||
|
||||
// 토큰 요청
|
||||
requestToken: () => Promise<any>;
|
||||
|
||||
// 간편 인증 등록
|
||||
registerBiometric: () => Promise<void>;
|
||||
|
||||
@@ -157,6 +163,20 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
return appBridge.safeCall(() => appBridge.removeStorage(key));
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const logout = useCallback(async (): Promise<void> => {
|
||||
if (!isNativeEnvironment) {
|
||||
throw new Error('Logout is only available in native environment');
|
||||
}
|
||||
return appBridge.safeCall(() => appBridge.logout());
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const requestToken = useCallback(async (): Promise<any> => {
|
||||
if (!isNativeEnvironment) {
|
||||
throw new Error('Token request is only available in native environment');
|
||||
}
|
||||
return appBridge.safeCall(() => appBridge.requestToken());
|
||||
}, [isNativeEnvironment]);
|
||||
|
||||
const registerBiometric = useCallback(async (): Promise<void> => {
|
||||
if (!isNativeEnvironment) {
|
||||
throw new Error('Biometric auth is only available in native environment');
|
||||
@@ -296,6 +316,8 @@ export const useAppBridge = (): UseAppBridgeReturn => {
|
||||
getContacts,
|
||||
*/
|
||||
shareContent,
|
||||
logout,
|
||||
requestToken,
|
||||
registerBiometric,
|
||||
openBiometricRegistrationPopup,
|
||||
closeBiometricRegistrationPopup
|
||||
|
||||
@@ -34,6 +34,9 @@ export enum BridgeMessageType {
|
||||
SET_STORAGE = 'setStorage',
|
||||
GET_STORAGE = 'getStorage',
|
||||
REMOVE_STORAGE = 'removeStorage',
|
||||
|
||||
// 토큰 요청
|
||||
REQUEST_TOKEN = 'requestToken',
|
||||
|
||||
// 카메라/갤러리
|
||||
OPEN_CAMERA = 'openCamera',
|
||||
|
||||
@@ -153,6 +153,10 @@ class AppBridge {
|
||||
return this.sendMessage(BridgeMessageType.REMOVE_STORAGE, { key });
|
||||
}
|
||||
|
||||
async requestToken(): Promise<any> {
|
||||
return this.sendMessage(BridgeMessageType.REQUEST_TOKEN);
|
||||
}
|
||||
|
||||
// 공유 관련
|
||||
async shareContent(content: ShareContent): Promise<void> {
|
||||
return this.sendMessage(BridgeMessageType.SHARE_CONTENT, content);
|
||||
|
||||
Reference in New Issue
Block a user