{"id":19850168,"url":"https://github.com/authsignal/aws-cognito-react-native-example","last_synced_at":"2025-02-28T20:47:06.233Z","repository":{"id":251849338,"uuid":"838595494","full_name":"authsignal/aws-cognito-react-native-example","owner":"authsignal","description":"An example app showing how to implement passkeys using the Authsignal React Native SDK with AWS Cognito","archived":false,"fork":false,"pushed_at":"2024-11-25T00:14:25.000Z","size":524,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-22T11:56:22.086Z","etag":null,"topics":["amplify","android","aws","cognito","ios","passkeys","react-native"],"latest_commit_sha":null,"homepage":"https://docs.authsignal.com/integrations/aws-cognito/react-native","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/authsignal.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-06T01:20:16.000Z","updated_at":"2024-11-25T00:14:29.000Z","dependencies_parsed_at":"2024-08-06T06:17:38.360Z","dependency_job_id":"7cd37adf-9211-4e55-b4b4-40cd6fed866b","html_url":"https://github.com/authsignal/aws-cognito-react-native-example","commit_stats":null,"previous_names":["authsignal/aws-cognito-react-native-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authsignal%2Faws-cognito-react-native-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authsignal%2Faws-cognito-react-native-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authsignal%2Faws-cognito-react-native-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/authsignal%2Faws-cognito-react-native-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/authsignal","download_url":"https://codeload.github.com/authsignal/aws-cognito-react-native-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241231135,"owners_count":19931096,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amplify","android","aws","cognito","ios","passkeys","react-native"],"created_at":"2024-11-12T13:24:36.920Z","updated_at":"2025-02-28T20:47:06.197Z","avatar_url":"https://github.com/authsignal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authsignal React Native + AWS Cognito Passkeys Example\n\nThis example is part of a [guide](https://docs.authsignal.com/integrations/aws-cognito/react-native) demonstrating how to integrate [Authsignal](https://www.authsignal.com) with [AWS Cognito](https://aws.amazon.com/cognito) when using [React Native](https://reactnative.dev).\n\nIt's part of a series of guides showing [different options for integrating Authsignal with AWS Cognito](https://docs.authsignal.com/integrations/aws-cognito/overview).\n\n## Prerequisites\n\nYou should follow the prerequisite steps described [here](https://docs.authsignal.com/sdks/client/react-native#prerequisites) to setup your Relying Party and your `apple-app-site-association` and `assetlinks.json` files.\n\n## Installation\n\n```\nyarn install\nnpx pod-install ios\n```\n\n## Configuration\n\nUpdate [this file](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/src/config.ts) with the config values for your Authsignal tenant and region-specific URL, along with the values for your AWS Cognito user pool.\n\n## The AWS lambdas\n\n### Create Auth Challenge lambda\n\nYou can find the full lambda code for this example [here](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/lambdas/create-auth-challenge.ts).\n\n### Verify Auth Challenge Response lambda\n\nYou can find the full lambda code for this example [here](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/lambdas/verify-auth-challenge-response.ts).\n\n## The app code\n\n### Sign up\n\nYou can find a full example of the sign up implementation [here](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/src/CreateAccountScreen.tsx#L41).\n\n#### 1. Call Amplify SDK `signUp` method\n\nPass the email as the username.\n\n```ts\nawait signUp({\n  username: email,\n  password: Math.random().toString(36).slice(-16) + 'X', // Dummy value - never used\n  options: {\n    userAttributes: {\n      email,\n    },\n  },\n});\n```\n\n#### 2. Call Amplify SDK `signIn` method\n\nThis step invokes the [Create Auth Challenge lambda](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/lambdas/create-auth-challenge.ts).\n\n```ts\nconst {nextStep} = await signIn({\n  username: email,\n  options: {\n    authFlowType: 'CUSTOM_WITHOUT_SRP',\n  },\n});\n```\n\n#### 3. Launch Authsignal pre-built UI\n\nPass the url returned by the [Create Auth Challenge lambda](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/lambdas/create-auth-challenge.ts).\n\n```ts\nconst url = nextStep.additionalInfo.url;\n\nconst token = await launch(url);\n```\n\n#### 4. Call Amplify SDK `confirmSignIn` method\n\nThis step invokes the [Verify Auth Challenge Response lambda](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/lambdas/verify-auth-challenge-response.ts).\n\n```ts\nconst {isSignedIn} = await confirmSignIn({\n  challengeResponse: token,\n});\n```\n\n### Sign in\n\nYou can find a full example of the sign in implementation [here](https://github.com/authsignal/aws-cognito-react-native-example/blob/main/src/SignInScreen.tsx#L22).\n\n#### 1. Call Authsignal SDK `passkey.signIn` method\n\n```ts\nconst {data} = await authsignal.passkey.signIn({\n  action: 'cognitoAuth',\n});\n```\n\n#### 2. Call Amplify SDK `signIn` and `confirmSignIn` methods\n\nPass the username and token returned by the Authsignal SDK.\n\n```ts\nawait signIn({\n  username: data.username,\n  options: {\n    authFlowType: 'CUSTOM_WITHOUT_SRP',\n  },\n});\n\nconst {isSignedIn} = await confirmSignIn({\n  challengeResponse: data.token,\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthsignal%2Faws-cognito-react-native-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauthsignal%2Faws-cognito-react-native-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauthsignal%2Faws-cognito-react-native-example/lists"}