Untitled
unknown
plain_text
6 months ago
2.1 kB
1
Indexable
Never
_linkWithApple = async () => { console.log('link with apple'); try { const appleAuthRequestResponse = await appleAuth.performRequest({ requestedOperation: appleAuth.Operation.LOGIN, requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME], }); const credentialState = await appleAuth.getCredentialStateForUser( appleAuthRequestResponse.user ); console.log('Main Token Apple Token ', appleAuthRequestResponse); await StorageProvider.set('PLATFORM', 'apple'); Keyboard.dismiss(); } catch (error) { console.log('user cancle login>>', error); } // try { // console.log('_linkWithApple'); // const appleAuthRequestResponse = await appleAuth.performRequest({ // requestedOperation: appleAuth.Operation.LOGIN, // requestedScopes: [appleAuth.Scope.EMAIL, appleAuth.Scope.FULL_NAME], // }); // console.log(appleAuthRequestResponse, 'appleAuthRequestResponse'); // // get current authentication state for user // // /!\ This method must be tested on a real device. On the iOS simulator it always throws an error. // const credentialState = await appleAuth.getCredentialStateForUser( // appleAuthRequestResponse.user // ); // if (credentialState === appleAuth.State.AUTHORIZED) { // // user is authenticated // console.log('user is authenticated'); // } // } catch (error) { // console.log(error, 'error'); // } }; _linkWithSpotify = async () => { console.log('link with spotify'); try { const session = await SpotifyAuth.authorize(this.spotifyConfig); await SpotifyRemote.connect(session.accessToken); console.log('getting spotify data>>>>>', session); await StorageProvider.set('USER_TOKEN_SPOTIFY', session.accessToken); await StorageProvider.set('REFRESH_TOKEN', session.refreshToken); await StorageProvider.set('PLATFORM', 'spotify'); } catch (error) { alert('Spotify is not Linked'); } };