agora-appbuilder-core 4.0.0-ms.7 → 4.0.0-ms.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agora-appbuilder-core",
3
- "version": "4.0.0-ms.7",
3
+ "version": "4.0.0-ms.8",
4
4
  "description": "React Native template for RTE app builder",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -15,23 +15,15 @@ import VideoCall from './pages/VideoCall';
15
15
  import Create from './pages/Create';
16
16
  import {Route, Switch, Redirect} from './components/Router';
17
17
  import AuthRoute from './auth/AuthRoute';
18
- import StoreToken from './components/StoreToken';
19
18
  import {IDPAuth} from './auth/IDPAuth';
20
- import Login from './pages/Login';
21
19
  import {Text} from 'react-native';
22
20
 
23
21
  function AppRoutes() {
24
22
  return (
25
23
  <Switch>
26
- {/* <Route exact path={'/login'}>
27
- <Login />
28
- </Route> */}
29
24
  <Route exact path={'/'}>
30
25
  <Redirect to={'/create'} />
31
26
  </Route>
32
- {/* <Route exact path={'/authorize/:token'}>
33
- <StoreToken />
34
- </Route> */}
35
27
  <Route exact path={'/authorize/:token?'}>
36
28
  <IDPAuth />
37
29
  </Route>
@@ -93,7 +93,7 @@ const AuthProvider = (props: AuthProviderProps) => {
93
93
  //adding time delay to open in app browser
94
94
  Toast.show({
95
95
  type: 'error',
96
- text1: 'Login session expired, Please login again.',
96
+ text1: 'Your session has timed out, Retrying.',
97
97
  visibilityTime: 3000,
98
98
  });
99
99
  setTimeout(() => {
@@ -227,13 +227,9 @@ const AuthProvider = (props: AuthProviderProps) => {
227
227
  });
228
228
  } else {
229
229
  if (location?.search?.indexOf('msg') !== -1) {
230
- //old : manage backend login failed. show error message and redirect to login again
231
- //new : IDP login already success, so don't need to show the error message
232
- //we will redirect use to IDP login
233
- //old code
234
230
  Toast.show({
235
231
  type: 'error',
236
- text1: 'Login session expired, Please login again.',
232
+ text1: 'Your session has timed out, Retrying.',
237
233
  visibilityTime: 3000,
238
234
  });
239
235
  setTimeout(() => {
@@ -1,4 +1,5 @@
1
1
  import {getOriginURL, getPlatformId, AUTH_ENDPOINT_URL} from './config';
2
+ import Toast from '../../react-native-toast-message';
2
3
 
3
4
  export const getIDPAuthLoginURL = () => {
4
5
  //redirect URL not require for electron
@@ -10,9 +11,19 @@ export const getIDPAuthLoginURL = () => {
10
11
  export const addEventListenerForToken = (history) => {
11
12
  window.addEventListener(
12
13
  'message',
13
- ({data, origin}: {data: {token: string}; origin: string}) => {
14
+ ({data, origin}: {data: {token: string; msg: string}; origin: string}) => {
14
15
  if (data?.token) {
15
16
  history.push(`/authorize/${data.token}`);
17
+ } else if (data?.msg && data?.msg === 'login_link_expired') {
18
+ Toast.show({
19
+ type: 'error',
20
+ text1: 'Your session has timed out, Retrying.',
21
+ visibilityTime: 3000,
22
+ });
23
+ setTimeout(() => {
24
+ //open auth login again
25
+ window.open(getIDPAuthLoginURL(), 'modal');
26
+ }, 3000);
16
27
  }
17
28
  },
18
29
  false,
@@ -1,5 +1,4 @@
1
- import React, {useEffect, useContext} from 'react';
2
- import AsyncStorage from '@react-native-async-storage/async-storage';
1
+ import React, {useEffect, useContext, useRef} from 'react';
3
2
  import jwt_decode from 'jwt-decode';
4
3
  import StorageContext from '../components/StorageContext';
5
4
  import SdkEvents from '../utils/SdkEvents';
@@ -7,9 +6,10 @@ import isSDK from '../utils/isSDK';
7
6
  const REFRESH_TOKEN_DURATION_IN_SEC = 59;
8
7
 
9
8
  const useTokenAuth = () => {
9
+ const tokenRef = useRef(null);
10
10
  const {setStore, store} = useContext(StorageContext);
11
11
  const [tokenExpiresAt, setTokenExpiresAt] = React.useState(0);
12
-
12
+ const timerRef = useRef(null);
13
13
  const updateToken = (token: string) => {
14
14
  setStore && setStore((store) => ({...store, token}));
15
15
  };
@@ -34,25 +34,32 @@ const useTokenAuth = () => {
34
34
  };
35
35
 
36
36
  const getRefreshToken = async () => {
37
- await fetch(`${$config.BACKEND_ENDPOINT}/v1/token/refresh`, {
38
- method: 'POST',
39
- headers: {
40
- 'Content-Type': 'application/json',
41
- authorization: store?.token ? `Bearer ${store.token}` : '',
42
- },
43
- })
44
- .then((response) => response.json())
45
- .then((data) => {
46
- if (data?.token) {
47
- updateToken(data.token);
48
- }
49
- });
37
+ if (store?.token) {
38
+ await fetch(`${$config.BACKEND_ENDPOINT}/v1/token/refresh`, {
39
+ method: 'POST',
40
+ headers: {
41
+ 'Content-Type': 'application/json',
42
+ authorization: store?.token ? `Bearer ${store.token}` : '',
43
+ },
44
+ })
45
+ .then((response) => response.json())
46
+ .then((data) => {
47
+ if (data?.token) {
48
+ updateToken(data.token);
49
+ if (isSDK()) {
50
+ SdkEvents.emit('token-refreshed');
51
+ }
52
+ }
53
+ });
54
+ } else {
55
+ console.log('debugging no token to refresh');
56
+ }
50
57
  };
51
58
 
52
59
  useEffect(() => {
53
60
  if (!tokenExpiresAt) return;
54
61
 
55
- const timer = setInterval(() => {
62
+ timerRef.current = setInterval(() => {
56
63
  const diffInSeconds = Math.floor(
57
64
  Math.abs(tokenExpiresAt - Date.now()) / 1000,
58
65
  );
@@ -65,35 +72,43 @@ const useTokenAuth = () => {
65
72
  SdkEvents.emit('will-token-expire');
66
73
  }
67
74
  getRefreshToken();
68
- clearInterval(timer);
75
+ clearInterval(timerRef.current);
69
76
  } catch (error) {
70
- clearInterval(timer);
77
+ clearInterval(timerRef.current);
71
78
  }
72
79
  }
73
80
  if (diffInSeconds < 0) {
74
- clearInterval(timer);
81
+ clearInterval(timerRef.current);
75
82
  }
76
83
  }, 1000);
77
84
 
78
85
  return () => {
79
- clearInterval(timer);
86
+ clearInterval(timerRef.current);
80
87
  };
81
88
  }, [tokenExpiresAt]);
82
89
 
83
90
  useEffect(() => {
84
91
  const syncToken = async () => {
85
- if (!store?.token) return;
86
- const decoded = jwt_decode(store.token);
87
- const expiresAt = decoded?.exp * 1000;
88
- if (Date.now() >= expiresAt) {
89
- if (isSDK()) {
90
- SdkEvents.emit('did-token-expire');
92
+ if (!store?.token) {
93
+ try {
94
+ timerRef.current && clearInterval(timerRef.current);
95
+ } catch (error) {
96
+ console.log('debugging error on clearing interval');
91
97
  }
92
- throw 'Token expired. Pass a new token';
93
98
  } else {
94
- setTokenExpiresAt(expiresAt);
99
+ const decoded = jwt_decode(store.token);
100
+ const expiresAt = decoded?.exp * 1000;
101
+ if (Date.now() >= expiresAt) {
102
+ if (isSDK()) {
103
+ SdkEvents.emit('did-token-expire');
104
+ }
105
+ console.log('token expired');
106
+ } else {
107
+ setTokenExpiresAt(expiresAt);
108
+ }
95
109
  }
96
110
  };
111
+ tokenRef.current = store.token;
97
112
  syncToken();
98
113
  }, [store?.token]);
99
114
 
@@ -109,24 +124,27 @@ const useTokenAuth = () => {
109
124
  token = store?.token;
110
125
  }
111
126
  if (token) {
112
- if (validateToken(token)) {
113
- if (updateTokenInStore) {
114
- updateToken(token);
115
- }
116
- setTimeout(() => {
117
- resolve(true);
118
- });
119
- } else {
120
- if (isSDK()) {
121
- SdkEvents.emit('did-token-expire');
127
+ try {
128
+ if (validateToken(token)) {
129
+ if (updateTokenInStore) {
130
+ updateToken(token);
131
+ }
132
+ setTimeout(() => {
133
+ resolve(true);
134
+ });
135
+ } else {
136
+ if (isSDK()) {
137
+ SdkEvents.emit('did-token-expire');
138
+ }
122
139
  }
123
- throw new Error('Token expired');
140
+ } catch (e) {
141
+ reject('Token expired');
124
142
  }
125
143
  } else {
126
144
  if (isSDK()) {
127
145
  SdkEvents.emit('token-not-found');
128
146
  }
129
- throw new Error('Token not found');
147
+ reject('Token not found');
130
148
  }
131
149
  } catch (error) {
132
150
  reject(error);
@@ -143,7 +161,9 @@ const useTokenAuth = () => {
143
161
  ? {credentials: 'include'}
144
162
  : {
145
163
  headers: {
146
- authorization: store?.token ? `Bearer ${store.token}` : '',
164
+ authorization: tokenRef.current
165
+ ? `Bearer ${tokenRef.current}`
166
+ : '',
147
167
  },
148
168
  },
149
169
  )
@@ -9,7 +9,7 @@
9
9
  information visit https://appbuilder.agora.io.
10
10
  *********************************************
11
11
  */
12
- import React, {useEffect} from 'react';
12
+ import React, {useContext, useEffect} from 'react';
13
13
  import {StyleSheet, View} from 'react-native';
14
14
  import {
15
15
  SHARE_LINK_CONTENT_TYPE,
@@ -25,15 +25,19 @@ import {isMobileUA, useIsDesktop} from '../../utils/common';
25
25
  import {useVideoCall} from '../useVideoCall';
26
26
  import {useParams} from '../Router';
27
27
  import useGetMeetingPhrase from '../../utils/useGetMeetingPhrase';
28
+ import {ErrorContext} from '../common';
28
29
 
29
30
  const InvitePopup = () => {
30
31
  const {setShowInvitePopup, showInvitePopup} = useVideoCall();
31
32
  const isDesktop = useIsDesktop();
32
33
  const {copyShareLinkToClipboard} = useShareLink();
33
34
  const {phrase} = useParams<{phrase: string}>();
35
+ const {setGlobalErrorMessage} = useContext(ErrorContext);
34
36
  const getMeeting = useGetMeetingPhrase();
35
37
  useEffect(() => {
36
- getMeeting(phrase);
38
+ getMeeting(phrase).catch((error) => {
39
+ setGlobalErrorMessage(error);
40
+ });
37
41
  }, [phrase]);
38
42
  return (
39
43
  <Popup
@@ -212,7 +212,8 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
212
212
 
213
213
  const getPstn = () => {
214
214
  let stringToCopy = '';
215
- if (pstn && pstn?.number && pstn?.pin) {
215
+ //sometimes backend pin value is zero and so removed the check
216
+ if (pstn && pstn?.number) {
216
217
  stringToCopy += `${PSTNNumberText}: ${pstn.number} ${PSTNPinText}: ${pstn.pin}`;
217
218
  }
218
219
 
@@ -233,6 +234,7 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
233
234
  break;
234
235
  case SHARE_LINK_CONTENT_TYPE.PSTN:
235
236
  stringToCopy = getPstn();
237
+ break;
236
238
  default:
237
239
  break;
238
240
  }
@@ -256,6 +258,7 @@ const ShareLinkProvider = (props: ShareLinkProvideProps) => {
256
258
  break;
257
259
  case SHARE_LINK_CONTENT_TYPE.PSTN:
258
260
  stringToCopy = getPstn();
261
+ break;
259
262
  default:
260
263
  break;
261
264
  }
@@ -62,6 +62,8 @@ const UserPreferenceProvider = (props: {children: React.ReactNode}) => {
62
62
  variables: {
63
63
  name,
64
64
  },
65
+ }).catch((error) => {
66
+ console.log('ERROR, could not save the name', error);
65
67
  });
66
68
  } catch (error) {
67
69
  console.log('ERROR, could not save the name', error);
@@ -37,6 +37,7 @@ export interface userEventsMapInterface {
37
37
  'token-not-found': () => void;
38
38
  'will-token-expire': () => void;
39
39
  'did-token-expire': () => void;
40
+ 'token-refreshed': () => void;
40
41
  }
41
42
 
42
43
  const SDKEvents = createNanoEvents<userEventsMapInterface>();
@@ -1,41 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
10
- *********************************************
11
- */
12
- import React from 'react';
13
- import {useHistory} from './Router';
14
- import SelectOAuth from '../subComponents/SelectOAuth';
15
- import {url, oAuthSystemType} from './OAuthConfig';
16
-
17
- const Oauth = () => {
18
- const history = useHistory();
19
- const onSelectOAuthSystem = ({
20
- oAuthSystem,
21
- }: {
22
- oAuthSystem: oAuthSystemType;
23
- }) => {
24
- console.log('electron OAuth');
25
- const oAuthUrl = url({platform: 'desktop'})[`${oAuthSystem}Url`];
26
- // @ts-ignore
27
- window.addEventListener(
28
- 'message',
29
- ({data, origin}: {data: {token: string}; origin: string}) => {
30
- if (data.token) {
31
- console.log(data, origin);
32
- history.push(`/auth-token/${data.token}`);
33
- }
34
- },
35
- false,
36
- );
37
- window.open(oAuthUrl, 'modal');
38
- };
39
- return <SelectOAuth onSelectOAuth={onSelectOAuthSystem} />;
40
- };
41
- export default Oauth;
@@ -1,55 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
10
- *********************************************
11
- */
12
- import React from 'react';
13
- import {Linking} from 'react-native';
14
- import InAppBrowser from 'react-native-inappbrowser-reborn';
15
- import {useHistory} from './Router';
16
- import SelectOAuth from '../subComponents/SelectOAuth';
17
-
18
- import {url, oAuthSystemType} from './OAuthConfig';
19
-
20
- const processUrl = (url: string): string => {
21
- return url
22
- .replace(`${$config.PRODUCT_ID.toLowerCase()}://my-host`, '')
23
- .replace($config.FRONTEND_ENDPOINT, '');
24
- };
25
-
26
- const Oauth = () => {
27
- let history = useHistory();
28
-
29
- const onSelectOAuthSystem = async ({
30
- oAuthSystem,
31
- }: {
32
- oAuthSystem: oAuthSystemType;
33
- }) => {
34
- try {
35
- // const url = `https://deep-link-tester.netlify.app`;
36
- const oAuthUrl = url({platform: 'mobile'})[`${oAuthSystem}Url`];
37
- if (await InAppBrowser.isAvailable()) {
38
- const result = await InAppBrowser.openAuth(oAuthUrl, oAuthUrl);
39
- console.log(JSON.stringify(result));
40
- if (result.type === 'success') {
41
- console.log('success', Linking.canOpenURL(result.url));
42
- history.push(processUrl(result.url));
43
- }
44
- } else {
45
- Linking.openURL(oAuthUrl);
46
- }
47
- } catch (error) {
48
- console.log(error.message);
49
- }
50
- };
51
-
52
- return <SelectOAuth onSelectOAuth={onSelectOAuthSystem} />;
53
- };
54
-
55
- export default Oauth;
@@ -1,30 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
10
- *********************************************
11
- */
12
- import React from 'react';
13
- import {Linking} from 'react-native';
14
- import SelectOAuth from '../subComponents/SelectOAuth';
15
- import {url, oAuthSystemType} from './OAuthConfig';
16
-
17
- const Oauth = () => {
18
- const onSelectOAuthSystem = ({
19
- oAuthSystem,
20
- }: {
21
- oAuthSystem: oAuthSystemType;
22
- }) => {
23
- const oAuthUrl = url({platform: 'web'})[`${oAuthSystem}Url`];
24
- console.log(oAuthUrl);
25
- Linking.openURL(oAuthUrl);
26
- };
27
- return <SelectOAuth onSelectOAuth={onSelectOAuthSystem} />;
28
- };
29
-
30
- export default Oauth;
@@ -1,87 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
10
- *********************************************
11
- */
12
- export type oAuthSystemType = 'google' | 'microsoft' | 'slack' | 'apple';
13
- type platformType = 'web' | 'mobile' | 'desktop';
14
- type oAuthUrlType = {
15
- googleUrl: string;
16
- microsoftUrl: string;
17
- slackUrl: string;
18
- appleUrl: string;
19
- };
20
-
21
- const getRedirectFrontEndUrl = ({platform}: {platform: platformType}) =>
22
- platform === 'web'
23
- ? `${window.location.origin}`
24
- : `${$config.BACKEND_ENDPOINT}`;
25
-
26
- export const oAuthGoogle = ({platform}: {platform: platformType}) => ({
27
- client_id: $config.GOOGLE_CLIENT_ID,
28
- auth_uri: 'https://accounts.google.com/o/oauth2/auth',
29
- redirect_uri: `${$config.BACKEND_ENDPOINT}/v1/oauth`,
30
- scope: encodeURIComponent(
31
- 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email',
32
- ),
33
- state: encodeURIComponent(
34
- `site=google&platform=${platform}&backend=${
35
- $config.BACKEND_ENDPOINT
36
- }&redirect=${getRedirectFrontEndUrl({platform})}/auth-token/`,
37
- ),
38
- });
39
-
40
- export const oAuthMicrosoft = ({platform}: {platform: platformType}) => ({
41
- client_id: $config.MICROSOFT_CLIENT_ID,
42
- auth_uri: 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
43
- redirect_uri: `${$config.BACKEND_ENDPOINT}/v1/oauth`,
44
- scope: 'openid',
45
- state: encodeURIComponent(
46
- `site=microsoft&platform=${platform}&redirect=${getRedirectFrontEndUrl({
47
- platform,
48
- })}/auth-token/&backend=${$config.BACKEND_ENDPOINT}`,
49
- ),
50
- });
51
-
52
- export const oAuthSlack = ({platform}: {platform: platformType}) => ({
53
- client_id: $config.SLACK_CLIENT_ID,
54
- auth_uri: 'https://slack.com/oauth/authorize',
55
- redirect_uri: `${$config.BACKEND_ENDPOINT}/v1/oauth`,
56
- scope: 'users.profile:read',
57
- state: encodeURIComponent(
58
- `site=slack&platform=${platform}&redirect=${getRedirectFrontEndUrl({
59
- platform,
60
- })}/auth-token/&backend=${$config.BACKEND_ENDPOINT}`,
61
- ),
62
- });
63
-
64
- export const oAuthApple = ({platform}: {platform: platformType}) => ({
65
- client_id: $config.APPLE_CLIENT_ID,
66
- auth_uri: 'https://appleid.apple.com/auth/authorize',
67
- redirect_uri: `${$config.BACKEND_ENDPOINT}/v1/oauth`,
68
- scope: 'name email',
69
- state: encodeURIComponent(
70
- `site=apple&platform=${platform}&redirect=${getRedirectFrontEndUrl({
71
- platform,
72
- })}/auth-token/&backend=${$config.BACKEND_ENDPOINT}`,
73
- ),
74
- });
75
-
76
- export const url = ({platform}: {platform: platformType}): oAuthUrlType => {
77
- const configGoogle = oAuthGoogle({platform});
78
- const configMicrosoft = oAuthMicrosoft({platform});
79
- const configSlack = oAuthSlack({platform});
80
- const configApple = oAuthApple({platform});
81
- return {
82
- googleUrl: `${configGoogle.auth_uri}?response_type=code&scope=${configGoogle.scope}&include_granted_scopes=true&state=${configGoogle.state}&client_id=${configGoogle.client_id}&redirect_uri=${configGoogle.redirect_uri}`,
83
- microsoftUrl: `${configMicrosoft.auth_uri}?response_type=code&scope=${configMicrosoft.scope}&include_granted_scopes=true&state=${configMicrosoft.state}&client_id=${configMicrosoft.client_id}&redirect_uri=${configMicrosoft.redirect_uri}`,
84
- slackUrl: `${configSlack.auth_uri}?response_type=code&scope=${configSlack.scope}&include_granted_scopes=true&state=${configSlack.state}&client_id=${configSlack.client_id}&redirect_uri=${configSlack.redirect_uri}`,
85
- appleUrl: `${configApple.auth_uri}?response_type=code&scope=${configApple.scope}&include_granted_scopes=true&state=${configApple.state}&response_mode=form_post&client_id=${configApple.client_id}&redirect_uri=${configApple.redirect_uri}`,
86
- };
87
- };
@@ -1,43 +0,0 @@
1
- /*
2
- ********************************************
3
- Copyright © 2021 Agora Lab, Inc., all rights reserved.
4
- AppBuilder and all associated components, source code, APIs, services, and documentation
5
- (the “Materials”) are owned by Agora Lab, Inc. and its licensors. The Materials may not be
6
- accessed, used, modified, or distributed for any purpose without a license from Agora Lab, Inc.
7
- Use without a license or in violation of any license terms and conditions (including use for
8
- any purpose competitive to Agora Lab, Inc.’s business) is strictly prohibited. For more
9
- information visit https://appbuilder.agora.io.
10
- *********************************************
11
- */
12
- import React, {useContext, useState} from 'react';
13
- import {Redirect, useParams} from './Router';
14
- import StorageContext from './StorageContext';
15
- import {Text} from 'react-native';
16
- import useMount from './useMount';
17
- import {useString} from '../utils/useString';
18
- import {useAuth} from '../auth/AuthProvider';
19
-
20
- const Authenticated = () => {
21
- //commented for v1 release
22
- //const authenticationSuccessLabel = useString('authenticationSuccessLabel')();
23
- const authenticationSuccessLabel = 'Authenticated Successfully!';
24
- return <Text> {authenticationSuccessLabel} </Text>;
25
- };
26
-
27
- const StoreToken = () => {
28
- const [ready, setReady] = useState(false);
29
- const {token}: {token: string} = useParams();
30
- const {setIsAuthenticated} = useAuth();
31
- const {setStore} = useContext(StorageContext);
32
- console.log('store token api', token);
33
-
34
- useMount(() => {
35
- setStore && setStore((store) => ({...store, token}));
36
- setIsAuthenticated(true);
37
- setReady(true);
38
- });
39
-
40
- return ready ? <Redirect to={'/create'} /> : <Authenticated />;
41
- };
42
-
43
- export default StoreToken;