Skip to content

Commit 7ab31ac

Browse files
authored
chore(react-native): add fed sign in example env (#6318)
1 parent 06419a7 commit 7ab31ac

File tree

10 files changed

+307
-237
lines changed

10 files changed

+307
-237
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"private": true,
3+
"name": "@aws-amplify/auth-with-email-mfa",
4+
"version": "0.0.1",
5+
"scripts": {
6+
"generate": "AWS_REGION=us-east-2 npx @aws-amplify/backend-cli@latest generate outputs --branch gen2-auth-with-email-mfa --app-id d3lukld24augjv"
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"private": true,
3+
"name": "@aws-amplify/ui-gen2-auth-federated-react-native",
4+
"version": "0.0.1",
5+
"scripts": {
6+
"generate": "AWS_REGION=us-east-2 npx @aws-amplify/backend-cli@latest generate outputs --branch gen2-auth-with-federated-react-native --app-id d3lukld24augjv"
7+
}
8+
}

environments/auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "@aws-amplify/ui-environments-auth",
44
"version": "0.0.1",
55
"scripts": {
6-
"pull": "../pull-environments.sh -r us-east-2",
6+
"pull": "../pull-environments.sh -r us-east-2 && ../generate-gen2-environments.sh",
77
"pull:email": "yarn pull -i \"\\./auth-with-email\""
88
}
99
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash
2+
3+
# naive script iterating over the "gen2" subdirs of the dir the script is executed from
4+
# executing the generate command for each
5+
for dir in gen2/*/; do yarn --cwd "$dir" generate; done

examples/react-native/README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,54 @@ import { MY_ENV_VARIABLE } from '@env';
186186

187187
If the example app is not picking up changes to the values in _.env_ close Metro and reset the cache (see troubleshooting section).
188188

189+
## URI Scheme
190+
191+
The example app default URI Scheme is set to `fed-auth-example://`.
192+
193+
To update for local testing run from the example app root:
194+
195+
```sh
196+
# remove default
197+
npx uri-scheme remove fed-auth-example
198+
199+
# add new schems
200+
npx uri-scheme add my-scheme
201+
```
202+
203+
- delete the app from your iOS simulator/Android emulator
204+
- rebuild the example app by run the respective build command(s) from the example app root:
205+
206+
```sh
207+
# iOS
208+
yarn run-ios
209+
210+
# OR
211+
# Android
212+
yarn run-android
213+
```
214+
215+
To test the scheme:
216+
217+
- ensure the example app is installed on an iOS simulator or Android emulator
218+
- start the example app
219+
220+
```sh
221+
yarn workspace @aws-amplify/ui-react-native-example dev
222+
```
223+
224+
- in a seperate terminal window, launch the app with the URI by running:
225+
226+
```sh
227+
# iOS
228+
npx uri-scheme open -i my-scheme://
229+
230+
# OR
231+
# Android
232+
npx uri-scheme open -a my-scheme://
233+
```
234+
235+
> see https://github.com/expo/expo/tree/main/packages/uri-scheme#readme for additional info
236+
189237
## Troubleshooting
190238

191239
### Cleaning the Metro Cache

examples/react-native/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<action android:name="android.intent.action.VIEW"/>
1111
<category android:name="android.intent.category.DEFAULT"/>
1212
<category android:name="android.intent.category.BROWSABLE"/>
13-
<data android:scheme="myapp"/>
13+
<data android:scheme="fed-auth-example"/>
1414
</intent-filter>
1515
</activity>
1616
</application>

0 commit comments

Comments
 (0)