-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: temporary disable twitter auth (#83)
- Loading branch information
Showing
6 changed files
with
2 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,5 @@ | ||
// SPDX-License-Identifier: ice License 1.0 | ||
|
||
import {ENV} from '@constants/env'; | ||
import RNTwitterSignIn from '@react-native-twitter-signin/twitter-signin'; | ||
import {SocialSignInMethod} from '@services/auth/signin/types'; | ||
import {checkProp} from '@utils/guards'; | ||
import {removeInvalidUsernameCharacters} from '@utils/username'; | ||
|
||
RNTwitterSignIn.init( | ||
ENV.TWITTER_CONSUMER_KEY ?? '', | ||
ENV.TWITTER_CONSUMER_SECRET ?? '', | ||
); | ||
|
||
export const startTwitterSignIn: SocialSignInMethod<{ | ||
token: string; | ||
secret: string; | ||
}> = async () => { | ||
try { | ||
// TODO:: create a patch for @react-native-twitter-signin/twitter-signin | ||
// the patch should add a request to @"https://api.twitter.com/1.1/users/lookup.json" to get the user.name | ||
// on iOS [client sendTwitterRequest] might be used | ||
const {authToken, authTokenSecret, userName, email} = | ||
await RNTwitterSignIn.logIn(); | ||
if (!authToken || !authTokenSecret) { | ||
throw new Error( | ||
'Twitter Sign-In failed - no authToken or authTokenSecret returned', | ||
); | ||
} | ||
return { | ||
cancelled: false, | ||
data: { | ||
token: authToken, | ||
secret: authTokenSecret, | ||
}, | ||
userInfo: { | ||
userHandle: removeInvalidUsernameCharacters( | ||
userName ?? email?.split('@')[0] ?? '', | ||
), | ||
firstName: null, | ||
lastName: null, | ||
}, | ||
}; | ||
} catch (error) { | ||
if ( | ||
// Android | ||
(checkProp(error, 'code') && error.code === 'USER_CANCELLED') || | ||
// iOS | ||
(checkProp(error, 'userInfo') && | ||
checkProp(error.userInfo, 'NSLocalizedDescription') && | ||
error.userInfo.NSLocalizedDescription === 'User cancelled login flow.') | ||
) { | ||
return { | ||
cancelled: true, | ||
}; | ||
} | ||
throw error; | ||
} | ||
export const startTwitterSignIn = () => { | ||
throw new Error('Temporary disabled'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1624,11 +1624,6 @@ | |
resolved "https://registry.yarnpkg.com/@react-native-masked-view/masked-view/-/masked-view-0.2.8.tgz#34405a4361882dae7c81b1b771fe9f5fbd545a97" | ||
integrity sha512-+1holBPDF1yi/y0uc1WB6lA5tSNHhM7PpTMapT3ypvSnKQ9+C6sy/zfjxNxRA/llBQ1Ci6f94EaK56UCKs5lTA== | ||
|
||
"@react-native-twitter-signin/twitter-signin@^1.2.0": | ||
version "1.2.0" | ||
resolved "https://registry.yarnpkg.com/@react-native-twitter-signin/twitter-signin/-/twitter-signin-1.2.0.tgz#37f050a544f97fb2cc28d039dc0d568ea1a806e8" | ||
integrity sha512-varhgZUxCyN6mhdjhoRixUmtVSVpI1jkHQSHgOVt9v+YIdHYx85Dtd/gfYIo1MRVMbh+hz3veiT5xTzil7Dbzg== | ||
|
||
"@react-native/[email protected]": | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/@react-native/assets/-/assets-1.0.0.tgz#c6f9bf63d274bafc8e970628de24986b30a55c8e" | ||
|