Skip to content

Commit c2e7e38

Browse files
authored
feat: auth0 https callback url (#1767)
* chore: upgrade auth0_flutter to v2.0.0 * feat: auth0 universal links * feat: auth0 android app link * fix: support android auth in debug builds without https * chore: update flutter_custom_tabs
1 parent 2781962 commit c2e7e38

8 files changed

Lines changed: 73 additions & 44 deletions

File tree

mobile-app/android/app/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ android {
5959
versionName flutterVersionName
6060
manifestPlaceholders += [
6161
auth0Domain: "freecodecamp-dev.auth0.com",
62-
auth0Scheme: "fccapp"
62+
auth0Scheme: "org.freecodecamp"
6363
]
6464
}
6565

@@ -76,6 +76,7 @@ android {
7676
release {
7777
signingConfig signingConfigs.release
7878
manifestPlaceholders['auth0Domain'] = "auth.freecodecamp.org"
79+
manifestPlaceholders['auth0Scheme'] = "https"
7980
}
8081
}
8182
}

mobile-app/android/app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@
2626
<action android:name="android.intent.action.MAIN"/>
2727
<category android:name="android.intent.category.LAUNCHER"/>
2828
</intent-filter>
29+
<intent-filter android:autoVerify="true">
30+
<action android:name="android.intent.action.VIEW" />
31+
<category android:name="android.intent.category.DEFAULT" />
32+
<category android:name="android.intent.category.BROWSABLE" />
33+
<data android:scheme="https"
34+
android:host="${auth0Domain}"
35+
android:pathPrefix="/android/${applicationId}/callback" />
36+
</intent-filter>
2937
</activity>
3038
<service android:name="com.ryanheise.audioservice.AudioService"
3139
android:foregroundServiceType="mediaPlayback"

mobile-app/ios/Podfile.lock

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ PODS:
44
- FlutterMacOS
55
- audio_session (0.0.1):
66
- Flutter
7-
- Auth0 (2.10.0):
8-
- JWTDecode (= 3.2.0)
9-
- SimpleKeychain (= 1.2.0)
10-
- auth0_flutter (1.9.0):
11-
- Auth0 (= 2.10.0)
7+
- Auth0 (2.16.2):
8+
- JWTDecode (= 3.3.0)
9+
- SimpleKeychain (= 1.3.0)
10+
- auth0_flutter (2.0.0):
11+
- Auth0 (= 2.16.2)
1212
- Flutter
1313
- FlutterMacOS
14-
- JWTDecode (= 3.2.0)
15-
- SimpleKeychain (= 1.2.0)
14+
- JWTDecode (= 3.3.0)
15+
- SimpleKeychain (= 1.3.0)
1616
- device_info_plus (0.0.1):
1717
- Flutter
1818
- Firebase/Analytics (11.10.0):
@@ -93,7 +93,7 @@ PODS:
9393
- FirebaseSharedSwift (~> 11.0)
9494
- GoogleUtilities/Environment (~> 8.0)
9595
- "GoogleUtilities/NSData+zlib (~> 8.0)"
96-
- FirebaseRemoteConfigInterop (11.12.0)
96+
- FirebaseRemoteConfigInterop (11.15.0)
9797
- FirebaseSessions (11.10.0):
9898
- FirebaseCore (~> 11.10.0)
9999
- FirebaseCoreExtension (~> 11.10.0)
@@ -103,7 +103,7 @@ PODS:
103103
- GoogleUtilities/UserDefaults (~> 8.0)
104104
- nanopb (~> 3.30910.0)
105105
- PromisesSwift (~> 2.1)
106-
- FirebaseSharedSwift (11.12.0)
106+
- FirebaseSharedSwift (11.15.0)
107107
- Flutter (1.0.0)
108108
- flutter_custom_tabs_ios (2.4.0):
109109
- Flutter
@@ -175,7 +175,7 @@ PODS:
175175
- just_audio (0.0.1):
176176
- Flutter
177177
- FlutterMacOS
178-
- JWTDecode (3.2.0)
178+
- JWTDecode (3.3.0)
179179
- nanopb (3.30910.0):
180180
- nanopb/decode (= 3.30910.0)
181181
- nanopb/encode (= 3.30910.0)
@@ -197,7 +197,7 @@ PODS:
197197
- shared_preferences_foundation (0.0.1):
198198
- Flutter
199199
- FlutterMacOS
200-
- SimpleKeychain (1.2.0)
200+
- SimpleKeychain (1.3.0)
201201
- sqflite_darwin (0.0.4):
202202
- Flutter
203203
- FlutterMacOS
@@ -316,8 +316,8 @@ EXTERNAL SOURCES:
316316
SPEC CHECKSUMS:
317317
audio_service: aa99a6ba2ae7565996015322b0bb024e1d25c6fd
318318
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
319-
Auth0: 2876d0c36857422eda9cb580a6cc896c7d14cb36
320-
auth0_flutter: eb1c74a8ddbd0a08533e47838a885b39c11b3951
319+
Auth0: f08ad1b74d49ffe806175845ef326d9a7674b34c
320+
auth0_flutter: ae848bc6be68205fac5a93f7f9a1dbc8ce3845e7
321321
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
322322
Firebase: 1fe1c0a7d9aaea32efe01fbea5f0ebd8d70e53a2
323323
firebase_analytics: 1998960b8fa16fd0cd9e77a6f9fd35a2009ad65e
@@ -332,9 +332,9 @@ SPEC CHECKSUMS:
332332
FirebaseCrashlytics: 84b073c997235740e6a951b7ee49608932877e5c
333333
FirebaseInstallations: 9980995bdd06ec8081dfb6ab364162bdd64245c3
334334
FirebaseRemoteConfig: 10695bc0ce3b103e3706a5578c43f2a9f69d5aaa
335-
FirebaseRemoteConfigInterop: 82b81fd06ee550cbeff40004e2c106daedf73e38
335+
FirebaseRemoteConfigInterop: 1c6135e8a094cc6368949f5faeeca7ee8948b8aa
336336
FirebaseSessions: 9b3b30947b97a15370e0902ee7a90f50ef60ead6
337-
FirebaseSharedSwift: d2475748a2d2a36242ed13baa34b2acda846c925
337+
FirebaseSharedSwift: e17c654ef1f1a616b0b33054e663ad1035c8fd40
338338
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
339339
flutter_custom_tabs_ios: 87333f36c33a5971502766aca2f6ff4823b09bda
340340
flutter_inappwebview_ios: b89ba3482b96fb25e00c967aae065701b66e9b99
@@ -346,7 +346,7 @@ SPEC CHECKSUMS:
346346
GoogleUtilities: 00c88b9a86066ef77f0da2fab05f65d7768ed8e1
347347
integration_test: 4a889634ef21a45d28d50d622cf412dc6d9f586e
348348
just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed
349-
JWTDecode: 7dae24cb9bf9b608eae61e5081029ec169bb5527
349+
JWTDecode: 1ca6f765844457d0dd8690436860fecee788f631
350350
nanopb: fad817b59e0457d11a5dfbde799381cd727c1275
351351
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
352352
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
@@ -356,7 +356,7 @@ SPEC CHECKSUMS:
356356
quick_actions_ios: 4b07fb49d8d8f3518d7565fbb7a91014067a7d82
357357
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
358358
shared_preferences_foundation: 9e1978ff2562383bd5676f64ec4e9aa8fa06a6f7
359-
SimpleKeychain: 768cf43ae778b1c21816e94dddf01bb8ee96a075
359+
SimpleKeychain: 9c0f3ca8458fed74e01db864d181c5cbe278603e
360360
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
361361
ua_client_hints: 92fe0d139619b73ec9fcb46cc7e079a26178f586
362362
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d

mobile-app/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5050
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5151
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
52+
D822870A2F7B3A120055031C /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
53+
D822870B2F7B3B4C0055031C /* RunnerRelease.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = RunnerRelease.entitlements; sourceTree = "<group>"; };
5254
/* End PBXFileReference section */
5355

5456
/* Begin PBXFrameworksBuildPhase section */
@@ -116,6 +118,8 @@
116118
97C146F01CF9000F007C117D /* Runner */ = {
117119
isa = PBXGroup;
118120
children = (
121+
D822870B2F7B3B4C0055031C /* RunnerRelease.entitlements */,
122+
D822870A2F7B3A120055031C /* Runner.entitlements */,
119123
97C146FA1CF9000F007C117D /* Main.storyboard */,
120124
97C146FD1CF9000F007C117D /* Assets.xcassets */,
121125
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
@@ -383,6 +387,7 @@
383387
buildSettings = {
384388
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
385389
CLANG_ENABLE_MODULES = YES;
390+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
386391
DEVELOPMENT_TEAM = L33K9LWVP9;
387392
ENABLE_BITCODE = NO;
388393
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -520,6 +525,7 @@
520525
buildSettings = {
521526
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
522527
CLANG_ENABLE_MODULES = YES;
528+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
523529
DEVELOPMENT_TEAM = L33K9LWVP9;
524530
ENABLE_BITCODE = NO;
525531
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
@@ -549,6 +555,7 @@
549555
buildSettings = {
550556
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
551557
CLANG_ENABLE_MODULES = YES;
558+
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
552559
DEVELOPMENT_TEAM = L33K9LWVP9;
553560
ENABLE_BITCODE = NO;
554561
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.developer.associated-domains</key>
6+
<array>
7+
<string>webcredentials:auth.freecodecamp.org</string>
8+
<string>webcredentials:freecodecamp-dev.auth0.com</string>
9+
</array>
10+
</dict>
11+
</plist>

mobile-app/lib/service/authentication/authentication_service.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'dart:io';
44

55
import 'package:auth0_flutter/auth0_flutter.dart';
66
import 'package:dio/dio.dart';
7+
import 'package:flutter/foundation.dart';
78
import 'package:flutter/material.dart';
89
import 'package:flutter_dotenv/flutter_dotenv.dart';
910
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
@@ -177,9 +178,10 @@ class AuthenticationService {
177178
},
178179
);
179180
} else {
181+
// NOTE: scheme is only needed for Android in debug mode, as the callback URL is different in that case
180182
creds = await auth0
181-
.webAuthentication(scheme: 'fccapp')
182-
.login(parameters: {'connection': connectionType});
183+
.webAuthentication(scheme: kReleaseMode ? null : 'org.freecodecamp')
184+
.login(useHTTPS: true, parameters: {'connection': connectionType});
183185
}
184186
} on WebAuthenticationException {
185187
// NOTE: The most likely case is that the user canceled the login

mobile-app/pubspec.lock

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,18 @@ packages:
141141
dependency: "direct main"
142142
description:
143143
name: auth0_flutter
144-
sha256: "33ed9d4e0236978c6dff965fd9be49102b1a2a0a3e571b8436ce1b74d3c6e57c"
144+
sha256: a09abfaa73876cf1f9168805a5cb06386761fed3040c587cf115123cba7c9307
145145
url: "https://pub.dev"
146146
source: hosted
147-
version: "1.9.0"
147+
version: "2.0.0"
148148
auth0_flutter_platform_interface:
149149
dependency: transitive
150150
description:
151151
name: auth0_flutter_platform_interface
152-
sha256: "3b259a155b4fc17fd5304403044807388b226468a176e1a11c3c2892515864d7"
152+
sha256: da9067b126f7e55467311867a68f1dde7d5f68a79610d4f562ce7be0fe99c3ec
153153
url: "https://pub.dev"
154154
source: hosted
155-
version: "1.9.0"
155+
version: "2.0.0"
156156
boolean_selector:
157157
dependency: transitive
158158
description:
@@ -253,10 +253,10 @@ packages:
253253
dependency: transitive
254254
description:
255255
name: characters
256-
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
256+
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
257257
url: "https://pub.dev"
258258
source: hosted
259-
version: "1.4.0"
259+
version: "1.4.1"
260260
checked_yaml:
261261
dependency: transitive
262262
description:
@@ -522,42 +522,42 @@ packages:
522522
dependency: "direct main"
523523
description:
524524
name: flutter_custom_tabs
525-
sha256: ac3543d7b4e0ac6ecdf3744360039ebb573656c0ce759149d228e1934d4f7535
525+
sha256: "8c3d92b074a8109f1dc76333c5ff8f87ea5896c118264c4b6b6e7d880058e820"
526526
url: "https://pub.dev"
527527
source: hosted
528-
version: "2.4.0"
528+
version: "2.5.0"
529529
flutter_custom_tabs_android:
530530
dependency: transitive
531531
description:
532532
name: flutter_custom_tabs_android
533-
sha256: "925fc5e7d27372ee523962dcfcd4b77c0443549482c284dd7897b77815547621"
533+
sha256: "84e6b856fae8ca347bf47156f2106aac5671441fd6b3c531d1b793d22d29dece"
534534
url: "https://pub.dev"
535535
source: hosted
536-
version: "2.3.1"
536+
version: "2.4.0"
537537
flutter_custom_tabs_ios:
538538
dependency: transitive
539539
description:
540540
name: flutter_custom_tabs_ios
541-
sha256: c61a58d30b29ccb09ea4da0daa335bbf8714bcf8798d0d9f4f58a0b83c6c421b
541+
sha256: "5f8bbfedad7ff60da4875d888085c05b1d0fd90acbfa4a624ae71b78c5cc6e37"
542542
url: "https://pub.dev"
543543
source: hosted
544-
version: "2.4.0"
544+
version: "2.5.0"
545545
flutter_custom_tabs_platform_interface:
546546
dependency: transitive
547547
description:
548548
name: flutter_custom_tabs_platform_interface
549-
sha256: "54a6ff5cc7571cb266a47ade9f6f89d1980b9ed2dba18162a6d5300afc408449"
549+
sha256: "2b66c541f3ca87fbf3e63808dbd41b28cb76f512acce5940f2468b33abe69031"
550550
url: "https://pub.dev"
551551
source: hosted
552-
version: "2.3.0"
552+
version: "2.4.0"
553553
flutter_custom_tabs_web:
554554
dependency: transitive
555555
description:
556556
name: flutter_custom_tabs_web
557-
sha256: "236e035c73b6d3ef0a2f85cd8b6b815954e7559c9f9d50a15ed2e53a297b58b0"
557+
sha256: d606b231859c79679c78dbf05293528a543e3e067c2893a3a5bed1ab9a8300bb
558558
url: "https://pub.dev"
559559
source: hosted
560-
version: "2.3.0"
560+
version: "2.4.0"
561561
flutter_dotenv:
562562
dependency: "direct main"
563563
description:
@@ -1144,18 +1144,18 @@ packages:
11441144
dependency: transitive
11451145
description:
11461146
name: matcher
1147-
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
1147+
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
11481148
url: "https://pub.dev"
11491149
source: hosted
1150-
version: "0.12.17"
1150+
version: "0.12.19"
11511151
material_color_utilities:
11521152
dependency: transitive
11531153
description:
11541154
name: material_color_utilities
1155-
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
1155+
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
11561156
url: "https://pub.dev"
11571157
source: hosted
1158-
version: "0.11.1"
1158+
version: "0.13.0"
11591159
meta:
11601160
dependency: transitive
11611161
description:
@@ -1709,10 +1709,10 @@ packages:
17091709
dependency: transitive
17101710
description:
17111711
name: test_api
1712-
sha256: ab2726c1a94d3176a45960b6234466ec367179b87dd74f1611adb1f3b5fb9d55
1712+
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
17131713
url: "https://pub.dev"
17141714
source: hosted
1715-
version: "0.7.7"
1715+
version: "0.7.10"
17161716
timezone:
17171717
dependency: "direct main"
17181718
description:

mobile-app/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ environment:
77
dependencies:
88
algolia_helper_flutter: 1.2.1
99
audio_service: 0.18.18
10-
auth0_flutter: 1.9.0
10+
auth0_flutter: 2.0.0
1111
cached_network_image: 3.4.1
1212
collection: 1.19.1
1313
device_info_plus: 11.3.0
@@ -18,7 +18,7 @@ dependencies:
1818
firebase_remote_config: 5.4.3
1919
flutter:
2020
sdk: flutter
21-
flutter_custom_tabs: 2.4.0
21+
flutter_custom_tabs: 2.5.0
2222
flutter_dotenv: 5.2.1
2323
flutter_heatmap_calendar: 1.0.5
2424
flutter_highlight: 0.7.0

0 commit comments

Comments
 (0)