From 829ce9e68504c076107d93b918d09b98abca1c57 Mon Sep 17 00:00:00 2001 From: Poovamraj T T Date: Thu, 10 Aug 2023 14:51:29 +0530 Subject: [PATCH] Move beta to prod --- .../native/react-native-beta/00-login.md | 250 ------------------ .../native/react-native-beta/download.md | 24 -- .../native/react-native-beta/files/app.md | 65 ----- .../native/react-native-beta/index.yml | 55 ---- .../native/react-native-beta/interactive.md | 250 ------------------ .../native/react-native-expo-beta/00-login.md | 221 ---------------- .../native/react-native-expo-beta/download.md | 24 -- .../react-native-expo-beta/files/app-json.md | 45 ---- .../react-native-expo-beta/files/app.md | 64 ----- .../native/react-native-expo-beta/index.yml | 58 ---- .../react-native-expo-beta/interactive.md | 189 ------------- .../native/react-native-expo/00-login.md | 58 ++-- .../react-native-expo/files/app-json.md | 1 - .../native/react-native-expo/files/app.md | 6 +- .../native/react-native-expo/index.yml | 2 +- .../native/react-native-expo/interactive.md | 34 ++- .../native/react-native/00-login.md | 46 ++-- .../native/react-native/files/app.md | 6 +- .../quickstart/native/react-native/index.yml | 2 +- .../native/react-native/interactive.md | 34 ++- 20 files changed, 74 insertions(+), 1360 deletions(-) delete mode 100644 articles/quickstart/native/react-native-beta/00-login.md delete mode 100644 articles/quickstart/native/react-native-beta/download.md delete mode 100644 articles/quickstart/native/react-native-beta/files/app.md delete mode 100644 articles/quickstart/native/react-native-beta/index.yml delete mode 100644 articles/quickstart/native/react-native-beta/interactive.md delete mode 100644 articles/quickstart/native/react-native-expo-beta/00-login.md delete mode 100644 articles/quickstart/native/react-native-expo-beta/download.md delete mode 100644 articles/quickstart/native/react-native-expo-beta/files/app-json.md delete mode 100644 articles/quickstart/native/react-native-expo-beta/files/app.md delete mode 100644 articles/quickstart/native/react-native-expo-beta/index.yml delete mode 100644 articles/quickstart/native/react-native-expo-beta/interactive.md diff --git a/articles/quickstart/native/react-native-beta/00-login.md b/articles/quickstart/native/react-native-beta/00-login.md deleted file mode 100644 index 772142a452..0000000000 --- a/articles/quickstart/native/react-native-beta/00-login.md +++ /dev/null @@ -1,250 +0,0 @@ ---- -title: Login -description: This tutorial demonstrates how to add user login to a React Native application using Auth0. -budicon: 448 -topics: - - quickstarts - - native - - react-native -github: - path: 00-Login-Hooks -contentType: tutorial -useCase: quickstart ---- - - - -This Quickstart is for the React Native framework. To integrate Auth0 into your Expo application, please refer to the [Expo Quickstart](https://auth0.com/docs/quickstart/native/react-native-expo/interactive) - -<%= include('../_includes/_getting_started', { library: 'React Native'}) %> - -## Install Dependencies - -In this section, you will install the React Native Auth0 module. - -::: note -Please refer to the [official documentation](https://facebook.github.io/react-native/) for additional details on React Native. -::: - -### Yarn - -```bash -yarn add react-native-auth0 -``` - -::: note -For further reference on yarn, check [their official documentation](https://yarnpkg.com/en/docs). -::: - -### npm - -```bash -npm install react-native-auth0 --save -``` - -### Additional iOS step: install the module Pod - -CocoaPods is the iOS package management tool the React Native framework uses to install itself into your project. For the iOS native module to work with your iOS app, first install the library Pod. If you're familiar with older React Native SDK versions, this is similar to the previous _linking a native module_. The process is now simplified: - -Change directory into the `ios` folder and run `pod install`. - -```bash -cd ios -pod install -``` - -First, you must provide a way for your users to log in. We recommend using the Auth0 hosted [login page](/hosted-pages/login). - -
Universal Login
- -## Integrate Auth0 in Your Application - -### Configure Android - -Open your app's `build.gradle` file (typically at `android/app/build.gradle`) and add the following manifest placeholders. The value for `auth0Domain` should contain your Auth0 application settings [as configured above](#get-your-application-keys). - -```groovy -android { - defaultConfig { - // Add the next line - manifestPlaceholders = [auth0Domain: "${account.namespace}", auth0Scheme: "<%= "${applicationId}.auth0" %>"] - } - ... -} -``` - -::: note -At runtime, the `applicationId` value will automatically update with your application's package name or ID (e.g. `com.example.app`). You can change this value from the `build.gradle` file. You can also check it at the top of your `AndroidManifest.xml` file. -::: - -### Configure iOS - -In the file `ios//AppDelegate.mm` add the following: - -```objc -#import - -- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url - options:(NSDictionary *)options -{ - return [RCTLinkingManager application:app openURL:url options:options]; -} -``` - -::: note -This file will be `ios//AppDelegate.m` on applications using the [old architecture](https://reactnative.dev/docs/next/new-architecture-app-intro#ios---use-objective-c-mm-extension). -::: - -Next, add a URLScheme using your App's bundle identifier. - -In the `ios` folder, open the `Info.plist` and locate the value for `CFBundleIdentifier` - -```xml -CFBundleIdentifier -$(PRODUCT_BUNDLE_IDENTIFIER) -``` - -Below this value, register a URL type entry using the value of `CFBundleIdentifier` as the value for the `CFBundleURLSchemes`. - -```xml -CFBundleURLTypes - - - CFBundleTypeRole - None - CFBundleURLName - auth0 - CFBundleURLSchemes - - $(PRODUCT_BUNDLE_IDENTIFIER).auth0 - - - -``` - -::: note -If your application was generated using the React Native CLI, the default value of `$(PRODUCT_BUNDLE_IDENTIFIER)` dynamically matches `org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)`. For the sample app, this value matches `com.auth0samples`. -::: - -Note this value as you'll be using it to define the callback URLs below. If desired, you can change it using XCode in the following way: - -- Open the `ios/.xcodeproj` file or run `xed ios` on a Terminal from the app root. -- Open your project's or desired target's Build Settings tab and find the section that contains "Bundle Identifier". -- Replace the "Bundle Identifier" value with your desired application's bundle identifier name. - -For additional information please read [react native docs](https://facebook.github.io/react-native/docs/linking). - - -### Configure Callback and Logout URLs - -The callback and logout URLs are the URLs that Auth0 invokes to redirect back to your application. Auth0 invokes the callback URL after authenticating the user, and the logout URL after removing the session cookie. - -If the callback and logout URLs are not set, users will be unable to log in and out of the application and will get an error. - -Go to the settings page of your [Auth0 application](${manage_url}/#/applications/${account.clientId}/settings) and add the corresponding URL to **Allowed Callback URLs** and **Allowed Logout URLs**, according to the platform of your application. If you are using a [custom domain](/customize/custom-domains), use the value of your custom domain instead of the Auth0 domain from the settings page. - -#### iOS -```text -BUNDLE_IDENTIFIER.auth0://${account.namespace}/ios/BUNDLE_IDENTIFIER/callback -``` -#### Android -```text -PACKAGE_NAME.auth0://${account.namespace}/android/PACKAGE_NAME/callback -``` - -::: note -If you are following along with our sample project, set this -- for iOS - `com.auth0samples.auth0://${account.namespace}/ios/com.auth0samples/callback` -- for Android - `com.auth0samples.auth0://${account.namespace}/android/com.auth0samples/callback` -::: - -## Add login to your app - -Import the `useAuth0` hook and the `Auth0Provider` component from the `react-native-auth0` package. - -```js -import {useAuth0, Auth0Provider} from 'react-native-auth0'; -``` - -Next, wrap your application in the `Auth0Provider` component, providing your Auth0 domain and Client ID values: - -```js -const App = () => { - return ( - - {/* your application */} - - ); -}; -``` - -Finally, present the hosted login screen using the `authorize` method from the `useAuth0` hook. See this usage example showing logging in on a button click: - -```js -const LoginButton = () => { - const {authorize} = useAuth0(); - - const onPress = async () => { - try { - await authorize(); - } catch (e) { - console.log(e); - } - }; - - return