aws-amplify / amplify-flutter

A declarative library with an easy-to-use interface for building Flutter applications on AWS.
https://docs.amplify.aws
Apache License 2.0
1.32k stars 247 forks source link

Getting `invalid_client` error page while doing sign in with apple using `Amplify.Auth.signInWithWebUI` #2450

Closed HappyMakadiyaS closed 1 year ago

HappyMakadiyaS commented 1 year ago

Description

I am trying to integrate Sign in with the apple Identity provider in flutter app. I have correctly done all the steps given in amplify auth documentation.

My Configuration: My flutter app bundle id = com.ssdemo.awscognitodemo Created app id in developer account same as bundle id = com.ssdemo.awscognitodemo Created service id = com.ssdemo.awscognitodemosid (postfix by sid) Noted down TeamID, KeyId and downloaded private key file(Auth_keyid.p8)

Web Authentication Configuration in my service id: Domains and Subdomains: Return URLs: https:///oauth2/idpresponse

Checked mark Sign in with Apple Identity provide in Hosted ui of AppClient and AppClient_Web.

Tried Solution But Doesn't work: Created custom domain for hosted ui - Limit to the domain name length

Open Url: https://appleid.apple.com/auth/authorize?client_id=com.ssdemo.awscognitodemosid&redirect_uri=https%3A%2F%2F****

Categories

Steps to Reproduce

No response

Screenshots

image

Platforms

Android Device/Emulator API Level

No response

Environment

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-arm, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

Dependencies

Dart SDK 2.18.4
Flutter SDK 3.3.8
aws_cognito_demo 1.0.0+1

dependencies:
- amplify_auth_cognito 0.6.10 [amplify_auth_cognito_android amplify_auth_cognito_ios amplify_core aws_common collection flutter meta plugin_platform_interface]
- amplify_flutter 0.6.10 [amplify_core amplify_datastore_plugin_interface amplify_flutter_android amplify_flutter_ios aws_common collection flutter meta plugin_platform_interface]
- cupertino_icons 1.0.5
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- fluttertoast 8.1.1 [flutter flutter_web_plugins]
- rename 2.0.1 [args logger]

transitive dependencies:
- amplify_auth_cognito_android 0.6.10 [flutter]
- amplify_auth_cognito_ios 0.6.10 [amplify_core flutter]
- amplify_core 0.6.10 [aws_common collection flutter intl json_annotation meta plugin_platform_interface uuid]
- amplify_datastore_plugin_interface 0.6.10 [amplify_core collection flutter meta]
- amplify_flutter_android 0.6.10 [flutter]
- amplify_flutter_ios 0.6.10 [amplify_core flutter]
- args 2.3.1
- async 2.9.0 [collection meta]
- aws_common 0.1.1 [async collection http meta stream_transform uuid]
- characters 1.2.1
- clock 1.1.1
- collection 1.16.0
- crypto 3.0.2 [typed_data]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- http 0.13.5 [async http_parser meta path]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- intl 0.17.0 [clock path]
- js 0.6.4
- json_annotation 4.7.0 [meta]
- logger 1.1.0
- material_color_utilities 0.1.5
- meta 1.8.0
- path 1.8.2
- plugin_platform_interface 2.1.3 [meta]
- sky_engine 0.0.99
- source_span 1.9.0 [collection path term_glyph]
- stream_transform 2.1.0
- string_scanner 1.1.1 [source_span]
- term_glyph 1.2.1
- typed_data 1.3.1 [collection]
- uuid 3.0.6 [crypto]
- vector_math 2.1.2

Device

Iphone xs

OS

iOS 15.5

Deployment Method

Amplify CLI

CLI Version

10.5.1

Additional Context

No response

Amplify Config

{
    "UserAgent": "aws-amplify-cli/2.0",
    "Version": "1.0",
    "auth": {
        "plugins": {
            "awsCognitoAuthPlugin": {
                "UserAgent": "aws-amplify-cli/0.1.0",
                "Version": "0.1.0",
                "IdentityManager": {
                    "Default": {}
                },
                "CredentialsProvider": {
                    "CognitoIdentity": {
                        "Default": {
                            "PoolId": "us-east-1:*************",
                            "Region": "us-east-1"
                        }
                    }
                },
                "CognitoUserPool": {
                    "Default": {
                        "PoolId": "us-east-1_*************",
                        "AppClientId": "66*************",
                        "Region": "us-east-1"
                    }
                },
                "Auth": {
                    "Default": {
                        "OAuth": {
                            "WebDomain": "***-dev.auth.us-east-1.amazoncognito.com",
                            "AppClientId": "66*************",
                            "SignInRedirectURI": "asd://",
                            "SignOutRedirectURI": "asd://",
                            "Scopes": [
                                "phone",
                                "email",
                                "openid",
                                "profile",
                                "aws.cognito.signin.user.admin"
                            ]
                        },
                        "authenticationFlowType": "USER_SRP_AUTH",
                        "socialProviders": [
                            "FACEBOOK",
                            "GOOGLE",
                            "APPLE"
                        ],
                        "usernameAttributes": [],
                        "signupAttributes": [],
                        "passwordProtectionSettings": {
                            "passwordPolicyMinLength": 8,
                            "passwordPolicyCharacters": []
                        },
                        "mfaConfiguration": "OFF",
                        "mfaTypes": [
                            "SMS"
                        ],
                        "verificationMechanisms": [
                            "EMAIL"
                        ]
                    }
                }
            }
        }
    }
}
HappyMakadiyaS commented 1 year ago

Now the link is working after 48 hrs of creating the apple key. Ref: https://developer.apple.com/forums/thread/124521#:~:text=I%20had%20to%20wait%2048h%20after%20creating%20my%20first%20key

dnys1 commented 1 year ago

I'm glad to hear it - sorry for the hassle and good to know for the future!

Daniel-HyunHo-Shin commented 1 year ago

I am experiencing a similar issue. I will post if it's solved like that