Skip to content

Instantly share code, notes, and snippets.

@phuctm97
Last active May 5, 2022 04:01
Show Gist options
  • Save phuctm97/81d9d5e5e0795b16a11c9e2740762993 to your computer and use it in GitHub Desktop.
Save phuctm97/81d9d5e5e0795b16a11c9e2740762993 to your computer and use it in GitHub Desktop.
Torus RN Cognito login
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