You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update the Flutter QS to feature HTTPS redirect URLs on iOS/macOS [SDK-4756] (#10385)
* Update the Flutter QS to include HTTPS redirect URLs on iOS/macOS
* Update the `download.md` instructions
* Update reference to Xcode UI
* Rework a few sentences
* Reword sentence in `download.md`
* Rephrase custom domain callout
Copy file name to clipboardexpand all lines: articles/quickstart/native/flutter/01-login.md
+78-8
Original file line number
Diff line number
Diff line change
@@ -26,7 +26,7 @@ github:
26
26
Auth0 allows you to quickly add authentication and access user profile information in your app. This guide demonstrates how to integrate Auth0 with a Flutter app using the [Auth0 Flutter SDK](https://github.com/auth0/auth0-flutter).
27
27
28
28
:::note
29
-
The Flutter SDK currently only supports Flutter app running on Android, iOS, and macOS platforms.
29
+
The Flutter SDK currently only supports Flutter apps for Android, iOS, and macOS.
30
30
:::
31
31
32
32
## Getting started
@@ -35,7 +35,49 @@ This quickstart assumes you already have a [Flutter](https://flutter.dev/) app u
35
35
36
36
You should also be familiar with the [Flutter command line tool](https://docs.flutter.dev/reference/flutter-cli).
37
37
38
-
<%= include('_configure_urls_interactive') %>
38
+
Finally, you will need a **Native** Auth0 application. If you don’t have a Native Auth0 application already, [create one](/get-started/auth0-overview/create-applications/native-apps) before continuing. Avoid using other application types, as they have different configurations and may cause errors.
39
+
40
+
### Configure the callback and logout URLs
41
+
42
+
The callback and logout URLs are the URLs that Auth0 invokes to redirect back to your app. Auth0 invokes the callback URL after authenticating the user, and the logout URL after removing the session cookie.
43
+
44
+
If the callback and logout URLs are not set, users will be unable to log in and out of the app and will get an error.
45
+
46
+
Go to the [settings page](${manage_url}/#/applications/${account.clientId}/settings) of your Auth0 application and add the following URLs to **Allowed Callback URLs** and **Allowed Logout URLs**, depending on the platform of your app. If you have a [custom domain](/customize/custom-domains), use this instead of the Auth0 domain from the settings page.
47
+
48
+
::: note
49
+
On Android, the value of the `SCHEME` placeholder can be `https` or some other custom scheme. `https` schemes require enabling [Android App Links](https://auth0.com/docs/get-started/applications/enable-android-app-links-support).
50
+
51
+
On iOS 17.4+ and macOS 14.4+ it is possible to use Universal Links (`https` scheme) as callback and logout URLs. When enabled, the SDK will fall back to using a custom URL scheme on older iOS / macOS versions –your app's [bundle identifier](https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids).
52
+
**This feature requires Xcode 15.3+ and a paid Apple Developer account**.
@@ -81,13 +123,37 @@ Run **Sync Project with Gradle Files** inside Android Studio to apply your chang
81
123
82
124
## Configure iOS/macOS
83
125
84
-
If you are not developing for the iOS or macOS platform, skip this step.
126
+
If you are not developing for the iOS or macOS platforms, skip this step.
127
+
128
+
::: warning
129
+
This step requires a paid Apple Developer account. It is needed to use Universal Links as callback and logout URLs. Skip this step to use a custom URL scheme instead.
130
+
:::
131
+
132
+
#### Configure the Team ID and bundle identifier
133
+
134
+
Go to the [settings page](${manage_url}/#/applications/${account.clientId}/settings) of your Auth0 application, scroll to the end, and open **Advanced Settings > Device Settings**. In the **iOS** section, set **Team ID** to your [Apple Team ID](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/), and **App ID** to your app's bundle identifier.
135
+
136
+
<p><imgsrc="/media/articles/native-platforms/ios-swift/ios-device-settings.png"alt="Screenshot of the iOS section inside the Auth0 application settings page"></p>
85
137
86
-
You need to register your bundle identifier as a custom URL scheme so the callback and logout URLs can reach your app.
138
+
This will add your app to your Auth0 tenant's `apple-app-site-association` file.
87
139
88
-
In Xcode, go to the **Info** tab of your app target settings. In the **URL Types** section, select the **+** button to add a new entry. Then enter `auth0` into the **Identifier** field and `$(PRODUCT_BUNDLE_IDENTIFIER)` into the **URL Schemes** field.
Open your app in Xcode by running `open ios/Runner.xcworkspace` (or `open macos/Runner.xcworkspace` for macOS). Go to the **Signing and Capabilities**[tab](https://developer.apple.com/documentation/xcode/adding-capabilities-to-your-app#Add-a-capability) of the **Runner** target settings, and press the **+ Capability** button. Then select **Associated Domains**.
143
+
144
+
<p><imgsrc="/media/articles/native-platforms/ios-swift/ios-xcode-capabilities.png"alt="Screenshot of the capabilities library inside Xcode"></p>
145
+
146
+
Next, add the following [entry](https://developer.apple.com/documentation/xcode/configuring-an-associated-domain#Define-a-service-and-its-associated-domain) under **Associated Domains**:
147
+
148
+
```text
149
+
webcredentials:${account.namespace}
150
+
```
151
+
152
+
If you have a [custom domain](/customize/custom-domains), use this instead of the Auth0 domain from the settings page.
153
+
154
+
::: note
155
+
For the associated domain to work, your app must be signed with your team certificate **even when building for the iOS simulator**. Make sure you are using the Apple Team whose Team ID is configured in the settings page of your Auth0 application.
156
+
:::
91
157
92
158
## Add login to your app
93
159
@@ -129,8 +195,10 @@ Next, redirect your users to the Auth0 Universal Login page using `webAuthentica
129
195
if (_credentials == null) {
130
196
ElevatedButton(
131
197
onPressed: () async {
198
+
// Use a Universal Link callback URL on iOS 17.4+ / macOS 14.4+
Copy file name to clipboardexpand all lines: articles/quickstart/native/flutter/_configure_urls_interactive.md
+28-22
Original file line number
Diff line number
Diff line change
@@ -2,44 +2,50 @@
2
2
3
3
To use Auth0 services, you need to have an application set up in the Auth0 Dashboard. The Auth0 application is where you will configure how you want authentication to work for your project.
4
4
5
-
:::note
6
-
The URLs below make use of a `SCHEME` placeholder, and this value varies depending on what platform you're working with. On Android, this can be `https` or some other custom scheme. On iOS/macOS, this is your app's [bundle identifier](https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids).
7
-
:::
8
-
9
5
### Configure an Auth0 application
10
6
11
-
Use the interactive selector to create a new "Native Application", or select an existing application that represents the project you want to integrate with. Every application in Auth0 is assigned an alphanumeric, unique client ID that your application code will use to call Auth0 APIs through the SDK.
7
+
Use the interactive selector to create a new Auth0 application or select an existing **Native** Auth0 application. Every application in Auth0 is assigned an alphanumeric, unique client ID that your application code will use to call Auth0 APIs through the SDK.
12
8
13
9
Any settings you configure using this quickstart will automatically update for your application in the <ahref="${manage_url}/#/">Dashboard</a>, which is where you can manage your applications in the future.
14
10
15
11
If you would rather explore a complete configuration, you can view a sample app instead.
16
12
17
-
### Configure Callback URLs
13
+
### Configure the callback and logout URLs
18
14
19
-
A callback URL is a URL in your app that you would like Auth0 to redirect users to after they have authenticated. If not set, users will not be returned to your app after they log in.
20
-
21
-
::: note
22
-
If you are following along with our sample project, set this to one of the following URLs, depending on your platform:
15
+
The callback and logout URLs are the URLs that Auth0 invokes to redirect back to your app. 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 app and will get an error.
On Android, the value of the `SCHEME` placeholder can be `https` or some other custom scheme. `https` schemes require enabling [Android App Links](https://auth0.com/docs/get-started/applications/enable-android-app-links-support).
On iOS 17.4+ and macOS 14.4+ it is possible to use Universal Links (`https` scheme) as callback and logout URLs. When enabled, the SDK will fall back to using a custom URL scheme on older iOS / macOS versions –your app's [bundle identifier](https://developer.apple.com/documentation/appstoreconnectapi/bundle_ids).
23
+
**This feature requires Xcode 15.3+ and a paid Apple Developer account**.
29
24
:::
30
25
31
-
###Configure Logout URLs
26
+
#### Android
32
27
33
-
A logout URL is a URL in your app that you would like Auth0 to redirect users to after they have logged out. If not set, users will not be able to log out from your app and will receive an error.
For example, if your iOS bundle identifier were `com.example.MyApp` and your Auth0 domain were `example.us.auth0.com`, then this value would be:
44
47
45
-
Lastly, be sure that the **Application Type** for your application is set to **Native** in the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings).
1) Set the **Allowed Callback URLs** and **Allowed Logout URLs** in the [Application Settings](${manage_url}/#/applications/${account.clientId}/settings) to the following value so it works for Android, iOS, and macOS apps:
3
+
> On every step, if you have a [custom domain](https://auth0.com/docs/customize/custom-domains), replace the `YOUR_AUTH0_DOMAIN` placeholder with your custom domain instead of the value from the settings page.
2) Rename the file `.env.example` to `.env`and fill in the following values:
7
+
Open the settings page of your Auth0 application and add the following URLs to **Allowed Callback URLs**and **Allowed Logout URLs**, depending on the platform you want to use.
> **This following requires Xcode 15.3+ and a paid Apple Developer account**. If you do not have a paid Apple Developer account, skip this step, and set the `useHTTPS` parameter to `false` in the `login()` and `logout()` calls at `lib/example_app.dart`.
26
16
27
-
4) Use the [Flutter CLI's](https://docs.flutter.dev/reference/flutter-cli)`run` command to run the app:
17
+
Open `ios/Runner.xcodeproj` (or `macos/Runner.xcodeproj`, for macOS) in Xcode and go to the settings of the **Runner** app target. In the **Signing & Capabilities** tab, change the bundle identifier from the default `com.auth0.samples.FlutterSample`to another value of your choosing. Then, make sure the **Automatically manage signing** box is checked, and that your Apple Team is selected.
28
18
29
-
```sh
30
-
flutter run
31
-
```
19
+
Next, find the `webcredentials:YOUR_AUTH0_DOMAIN` entry under **Associated Domains**, and replace the `YOUR_AUTH0_DOMAIN` placeholder with the domain of your Auth0 application.
20
+
21
+
Finally, open the settings page of your Auth0 application, scroll to the end, and open **Advanced Settings > Device Settings**. In the **iOS** section, set **Team ID** to your [Apple Team ID](https://developer.apple.com/help/account/manage-your-team/locate-your-team-id/), and **App ID** to the app's bundle identifier.
22
+
23
+
## 3. Run the app
24
+
25
+
Use the [Flutter CLI](https://docs.flutter.dev/reference/flutter-cli) to run the app: `flutter run`.
0 commit comments