Last active
May 5, 2022 04:01
-
-
Save phuctm97/81d9d5e5e0795b16a11c9e2740762993 to your computer and use it in GitHub Desktop.
Torus RN Cognito login
This file contains hidden or 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
import TorusSdk from "@toruslabs/torus-direct-react-native-sdk"; | |
const App = () => { | |
const onMount = async () => { | |
await TorusSdk.init({ | |
browserRedirectUri: "YOUR APP REDIRECT URI", | |
redirectUri: "YOUR APP REDIRECT URI", | |
network: "testnet" | |
}); | |
}; | |
useEffect(() => { | |
onMount(); | |
}); | |
const onClickLogin = async () => { | |
const user = await login(); | |
const { privateKey, publicAddress } = await TorusSdk.getAggregateTorusKey("alice-cognito-test", user.sub, [{ | |
verifier: "cognito", | |
idToken: user.idToken | |
}]); | |
}; | |
return <Component onClickLogin={onClickLogin} /> | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment