diff --git a/react-native-sign-in-with-neynar/package.json b/react-native-sign-in-with-neynar/package.json index 4056e23..ff0353a 100644 --- a/react-native-sign-in-with-neynar/package.json +++ b/react-native-sign-in-with-neynar/package.json @@ -1,6 +1,6 @@ { "name": "@neynar/react-native-signin", - "version": "0.2.8", + "version": "1.0.0", "keywords": [ "react-native", "neynar", diff --git a/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx b/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx index 8dfa8a0..aba7fc2 100644 --- a/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx +++ b/react-native-sign-in-with-neynar/src/NeynarSigninButton.tsx @@ -40,8 +40,7 @@ enum ButtonText { } interface IProps { - apiKey: string; - clientId: string; + authUrl: string; successCallback: (data: ISuccessMessage) => void; errorCallback?: (error: any) => void; theme?: Theme; @@ -76,8 +75,7 @@ interface IProps { } export const NeynarSigninButton = ({ - apiKey, - clientId, + authUrl, successCallback, errorCallback = () => {}, theme = Theme.LIGHT, @@ -99,7 +97,6 @@ export const NeynarSigninButton = ({ textStyles: customTextStyle, }: IProps) => { const [modalVisible, setModalVisible] = useState(false); - const [authUrl, setAuthUrl] = useState(null); const handleMessage = (event: WebViewMessageEvent) => { const data = JSON.parse(event.nativeEvent.data); @@ -108,20 +105,7 @@ export const NeynarSigninButton = ({ }; const handleOnPress = async () => { - try { - const response = await fetch( - `https://api.neynar.com/v2/farcaster/login/authorize?api_key=${apiKey}&response_type=code&client_id=${clientId}` - ); - - if (!response.ok) throw new Error("Something went wrong"); - - const json = await response.json(); - setAuthUrl(json.authorization_url); - setModalVisible(true); - } catch (err) { - errorCallback(err); - setModalVisible(false); - } + setModalVisible(true); }; const getLogo = () => { @@ -217,7 +201,7 @@ export const NeynarSigninButton = ({ {"Close"} - {authUrl && ( + {authUrl ? ( + ) : ( + + {"authUrl is required"} + )}