Skip to content

Commit

Permalink
Fix React Native for react-native-auth0 3 (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
mraible authored Sep 12, 2023
1 parent 7a3e8d8 commit f2a2a84
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -461,12 +461,12 @@ You can also use the Okta Admin Console:
3. Specify a name and description of your choosing.
4. Select **Native** and use the following for your Callback and Logout URLs:

org.reactjs.native.example.<yourappname>://<your-auth0-domain>/ios/org.reactjs.native.example.<yourAppName>/callback,com.<yourappname>://<your-auth0-domain>/android/com.<yourappname>/callback
org.reactjs.native.example.<yourappname>.auth0://<your-auth0-domain>/ios/org.reactjs.native.example.<yourappname>/callback,com.<yourappname>.auth0://<your-auth0-domain>/android/com.<yourappname>/callback

**NOTE:** The `<yourappname>` and `<yourAppName>` placeholders is the iOS callback have different cases. The first is all lowercase and the second is camel case. For example:
For example:

```
org.reactjs.native.example.secureauth0://dev-06bzs1cu.us.auth0.com/ios/org.reactjs.native.example.SecureAuth0/callback, com.secureauth0://dev-06bzs1cu.us.auth0.com/android/com.secureauth0/callback
org.reactjs.native.example.secureauth0.auth0://dev-06bzs1cu.us.auth0.com/ios/org.reactjs.native.example.secureauth0/callback, com.secureauth0.auth0://dev-06bzs1cu.us.auth0.com/android/com.secureauth0/callback
```

Install the Schematics CLI globally.
Expand All @@ -490,12 +490,12 @@ You can also use the Auth0 Console:
* Select the **Settings** tab.
* Add the following for Allowed Callback and Logout URLs:

org.reactjs.native.example.<yourappname>://<your-auth0-domain>/ios/org.reactjs.native.example.<yourAppName>/callback,com.<yourappname>://<your-auth0-domain>/android/com.<yourappname>/callback
org.reactjs.native.example.<yourappname>.auth0://<your-auth0-domain>/ios/org.reactjs.native.example.<yourappname>/callback,com.<yourappname>.auth0://<your-auth0-domain>/android/com.<yourappname>/callback

For example:

```
org.reactjs.native.example.secureauth0://dev-06bzs1cu.us.auth0.com/ios/org.reactjs.native.example.SecureAuth0/callback, com.secureauth0://dev-06bzs1cu.us.auth0.com/android/com.secureauth0/callback
org.reactjs.native.example.secureauth0.auth0://dev-06bzs1cu.us.auth0.com/ios/org.reactjs.native.example.secureauth0/callback, com.secureauth0.auth0://dev-06bzs1cu.us.auth0.com/android/com.secureauth0/callback
```

### iOS
Expand Down
12 changes: 10 additions & 2 deletions src/add-auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ import { AuthModule } from './auth/auth.module';`);
if (appBuild) {
let manifestPlaceholders;
if (options.auth0) {
manifestPlaceholders = `auth0Domain: "${options.issuer}", auth0Scheme: "\${applicationId}"`
manifestPlaceholders = `auth0Domain: "${options.issuer}", auth0Scheme: "\${applicationId}.auth0"`
} else {
manifestPlaceholders = `appAuthRedirectScheme: "${options.packageName}"`
}
Expand All @@ -361,11 +361,19 @@ import { AuthModule } from './auth/auth.module';`);
\t\t\t<string>auth0</string>
\t\t\t<key>CFBundleURLSchemes</key>
\t\t\t<array>
\t\t\t\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
\t\t\t\t<string>$(PRODUCT_BUNDLE_IDENTIFIER).auth0</string>
\t\t\t</array>
\t\t</dict>
\t</array>`);
host.overwrite(`ios/${appName}/Info.plist`, iosURLs);

// Update Podfile to require iOS 13
const podfile: Buffer | null = host.read(`./ios/Podfile`);
if (podfile) {
const podfileContents = podfile.toString('utf-8')
.replace('platform :ios, min_ios_version_supported', 'platform :ios, \'13.0\'');
host.overwrite(`ios/Podfile`, podfileContents);
}
}
}

Expand Down

0 comments on commit f2a2a84

Please sign in to comment.