Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Sign In With Google and Apple #84

Merged
merged 44 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
577c563
feat: get current session information
sashatalalasha Aug 18, 2023
6b5239c
feat: create login flow
sashatalalasha Aug 18, 2023
8ec2806
feat: login with email and password
sashatalalasha Aug 23, 2023
b89a99d
feat: register with email and password
sashatalalasha Aug 23, 2023
81290a0
fix: handle all errors incl deserialization error
sashatalalasha Aug 24, 2023
e00383d
feat: logout & get session on home page init
sashatalalasha Aug 24, 2023
a6459a0
feat: show session information
sashatalalasha Aug 29, 2023
bd77e99
feat: add design and refactor blocs
sashatalalasha Sep 1, 2023
e7658a3
fix: change package and folder name
sashatalalasha Sep 1, 2023
e033adf
fix: change package name
sashatalalasha Sep 1, 2023
f297235
docs: update README.md
sashatalalasha Sep 1, 2023
7244c6c
refactor: delete unused icon
sashatalalasha Sep 1, 2023
6f7ddc6
refactor: remove unused packages
sashatalalasha Sep 1, 2023
b43fdd0
chore: format code
sashatalalasha Sep 1, 2023
3cf26b0
refactor: add missing package and delete unused test
sashatalalasha Sep 4, 2023
e631a1f
chore: display components dynamically
sashatalalasha Oct 2, 2023
6917e92
chore: clean up and format code
sashatalalasha Oct 2, 2023
8f771f0
fix: aal2 navigation
sashatalalasha Oct 2, 2023
c9de1f1
chore: remove unnecessary code
sashatalalasha Oct 4, 2023
b815ba1
feat: sign in/up with google account on iOS
sashatalalasha Oct 11, 2023
1cfd74e
chore: add ios url scheme and web clientId
sashatalalasha Oct 11, 2023
1203c21
chore: fix typo and rename variables
sashatalalasha Oct 16, 2023
ce12100
chore: separate exception handlings
sashatalalasha Oct 16, 2023
3719abd
fix: prevent null exception
sashatalalasha Oct 16, 2023
a8a95bb
Merge branch 'flutter-app-email-password' into flutter-app-social-sig…
sashatalalasha Oct 18, 2023
7439b5c
chore: change package name and add auth packages
sashatalalasha Oct 20, 2023
7a21e5c
feat: add apple & google sign in
sashatalalasha Oct 23, 2023
cf68bc1
chore: delete unnecessary exception handling
sashatalalasha Oct 23, 2023
e64fc40
feat: add flutter app Ory Network example (#82)
sashatalalasha Oct 18, 2023
e21fed5
Merge branch 'master' into flutter-app-social-sign-in
sashatalalasha Oct 25, 2023
a595f29
chore: delete unused assets and widgets
sashatalalasha Oct 25, 2023
3d83120
chore: remove misleading widget
sashatalalasha Oct 25, 2023
8a03f41
Update README.md
sashatalalasha Oct 25, 2023
f1a78c6
Update README.md
sashatalalasha Oct 25, 2023
a08df3d
chore: add formatting
sashatalalasha Oct 25, 2023
d58aa9c
chore: add formatting
sashatalalasha Oct 25, 2023
a10af93
chore: change package name
sashatalalasha Nov 3, 2023
03ecf84
chore: delete build artifacts
sashatalalasha Nov 3, 2023
b5f358b
chore: update gitignore
sashatalalasha Nov 3, 2023
94e2ee3
chore: add comment about web client id
sashatalalasha Nov 3, 2023
6c758b8
chore: add Info.plist snippet to readme
sashatalalasha Nov 3, 2023
e42c22b
chore: fix typo
sashatalalasha Nov 3, 2023
f698567
chore: fix format
sashatalalasha Nov 3, 2023
c2de861
chore: fix format
sashatalalasha Nov 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions flutter-ory-network/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,31 @@ Create .env file with your project url in the root folder of the Flutter app
ORY_BASE_URL=https://{your-project-slug}.projects.oryapis.com
```

### Google Sign In

If you use Google Sign In on Android, add following variable to .env file

```env
WEB_CLIENT_ID={web-client-id}.apps.googleusercontent.com
```

If you use Google Sign In on iOS, add following variable to .env file

```env

IOS_CLIENT_ID={ios-client-id}.apps.googleusercontent.com
```

Additionally, add reversed Client ID com.googleusercontent.apps.{ios-client.id}
as iOS URL scheme to Info.plist.\
sashatalalasha marked this conversation as resolved.
Show resolved Hide resolved
For more information, see [Google Integration Docs](https://www.ory.sh/docs/kratos/social-signin/google).

### Apple Sign In

To configure Apple Sign In on IOS, see
[Apple Integration Docs](https://www.ory.sh/docs/kratos/social-signin/apple).\
To configure Apple Sign In on Android, see [Social sign-in for native and mobile apps ](https://www.ory.sh/docs/kratos/social-signin/native-apps).

### Run locally

1. Install dependencies from `pubspec.yaml`
Expand Down
6 changes: 3 additions & 3 deletions flutter-ory-network/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace "com.example.ory_network_flutter"
namespace "com.ory.flutter_ory_network"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand All @@ -45,10 +45,10 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.ory_network_flutter"
applicationId "com.ory.flutter_ory_network"
sashatalalasha marked this conversation as resolved.
Show resolved Hide resolved
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 18
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
41 changes: 35 additions & 6 deletions flutter-ory-network/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:label="Ory Network Flutter"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:exported="true"
Expand All @@ -16,12 +18,39 @@
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />

<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.linusu.flutter_web_auth.CallbackActivity"
android:exported="true">
<intent-filter android:label="flutter_web_auth">
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="ory" />
</intent-filter>
</activity>

<!-- Set up the Sign in with Apple activity, such that it's callable from the browser-redirect -->
<activity
android:name="com.aboutyou.dart_packages.sign_in_with_apple.SignInWithAppleCallback"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data android:scheme="signinwithapple" />
<data android:path="callback" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0

// Generated file.
//
// If you wish to remove Flutter's multidex support, delete this entire file.
//
// Modifications to this file should be done in a copy under a different name
// as this file may be regenerated.

package io.flutter.app;

import android.app.Application;
import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.multidex.MultiDex;

/**
* Extension of {@link android.app.Application}, adding multidex support.
*/
public class FlutterMultiDexApplication extends Application {
@Override
@CallSuper
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.ory.flutter_ory_network

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
sashatalalasha marked this conversation as resolved.
Show resolved Hide resolved
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
44 changes: 44 additions & 0 deletions flutter-ory-network/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,28 +1,72 @@
PODS:
- AppAuth (1.6.2):
- AppAuth/Core (= 1.6.2)
- AppAuth/ExternalUserAgent (= 1.6.2)
- AppAuth/Core (1.6.2)
- AppAuth/ExternalUserAgent (1.6.2):
- AppAuth/Core
- Flutter (1.0.0)
- flutter_secure_storage (6.0.0):
- Flutter
- flutter_web_auth (0.5.0):
- Flutter
- google_sign_in_ios (0.0.1):
- Flutter
- GoogleSignIn (~> 6.2)
- GoogleSignIn (6.2.4):
- AppAuth (~> 1.5)
- GTMAppAuth (~> 1.3)
- GTMSessionFetcher/Core (< 3.0, >= 1.1)
- GTMAppAuth (1.3.1):
- AppAuth/Core (~> 1.6)
- GTMSessionFetcher/Core (< 3.0, >= 1.5)
- GTMSessionFetcher/Core (2.3.0)
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sign_in_with_apple (0.0.1):
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
- flutter_web_auth (from `.symlinks/plugins/flutter_web_auth/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)

SPEC REPOS:
trunk:
- AppAuth
- GoogleSignIn
- GTMAppAuth
- GTMSessionFetcher

EXTERNAL SOURCES:
Flutter:
:path: Flutter
flutter_secure_storage:
:path: ".symlinks/plugins/flutter_secure_storage/ios"
flutter_web_auth:
:path: ".symlinks/plugins/flutter_web_auth/ios"
google_sign_in_ios:
:path: ".symlinks/plugins/google_sign_in_ios/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
sign_in_with_apple:
:path: ".symlinks/plugins/sign_in_with_apple/ios"

SPEC CHECKSUMS:
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be
flutter_web_auth: c25208760459cec375a3c39f6a8759165ca0fa4d
google_sign_in_ios: 1256ff9d941db546373826966720b0c24804bcdd
GoogleSignIn: 5651ce3a61e56ca864160e79b484cd9ed3f49b7a
GTMAppAuth: 0ff230db599948a9ad7470ca667337803b3fc4dd
GTMSessionFetcher: 3a63d75eecd6aa32c2fc79f578064e1214dfdec2
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440

PODFILE CHECKSUM: 70d9d25280d0dd177a5f637cdb0f0b0b12c6a189

Expand Down
15 changes: 11 additions & 4 deletions flutter-ory-network/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
2FC830B17BFE3D0034060C69 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
311C9A0E2AD94FCA0082AC0F /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -130,6 +131,7 @@
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
311C9A0E2AD94FCA0082AC0F /* Runner.entitlements */,
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
Expand All @@ -152,7 +154,6 @@
5049002C15409643EB52610C /* Pods-RunnerTests.release.xcconfig */,
572786F99F7DFEE344A536D0 /* Pods-RunnerTests.profile.xcconfig */,
);
name = Pods;
path = Pods;
sourceTree = "<group>";
};
Expand Down Expand Up @@ -467,14 +468,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 44TJKWD29H;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter;
PRODUCT_BUNDLE_IDENTIFIER = "com.ory.flutter-ory-network";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -645,14 +648,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 44TJKWD29H;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter;
PRODUCT_BUNDLE_IDENTIFIER = "com.ory.flutter-ory-network";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand All @@ -667,14 +672,16 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 44TJKWD29H;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.example.ory_network_flutter;
PRODUCT_BUNDLE_IDENTIFIER = "com.ory.flutter-ory-network";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
14 changes: 13 additions & 1 deletion flutter-ory-network/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,25 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>ory_network_flutter</string>
<string>flutter_ory_network</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<!-- TODO Replace this value with iOS URL scheme from Google Cloud Console -->
<string>IOS_URL_SCHEME</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
Expand Down
10 changes: 10 additions & 0 deletions flutter-ory-network/ios/Runner/Runner.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.applesignin</key>
<array>
<string>Default</string>
</array>
</dict>
</plist>
Loading
Loading