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