-
Notifications
You must be signed in to change notification settings - Fork 222
Closed
Labels
authIssues related to the Auth categoryIssues related to the Auth categoryquestionGeneral questionGeneral question
Description
Describe the bug
It is not a bug, I think I am doing something wrong.
I followed this steps to Sign in with Apple, but get this error:
Failed execution for Auth.socialWebUISignInAPI with error:
AuthError: Make sure that the amplify configuration passed to Auth plugin is valid
I have checked all the values are correct at least 3 times. What else do I need to check?
One concern, amplify update auth
require key id before creating the actual key. how is it possible to get a Key id before creating them?
Steps To Reproduce
Steps to reproduce the behavior:
1. Create an App ID
2. Create a Service ID
3. Create a Key
4. Do this in terminal
% amplify update auth
Please note that certain attributes may not be overwritten if you choose to use defaults settings.
You have configured resources that might depend on this Cognito resource. Updating this Cognito resource could have unintended side effects.
Using service: Cognito, provided by: awscloudformation
What do you want to do? Apply default configuration with Social Provider (Feder
ation)
What domain name prefix do you want to use? iris26e476d4-26e476d4
Enter your redirect signin URI: iris://
? Do you want to add another redirect signin URI No
Enter your redirect signout URI: iris://
? Do you want to add another redirect signout URI No
Select the identity providers you want to configure for your user pool: Sign in
with Apple
You've opted to allow users to authenticate via Sign in with Apple. If you have
n't already, you'll need to go to https://developer.apple.com/account/#/welcome
and configure Sign in with Apple.
Enter your Services ID for your OAuth flow: com.zasso.iris
Enter your Team ID for your OAuth flow: 86USSQ2K46
Enter your Key ID for your OAuth flow: 4A772NX2MB
Enter your Private Key for your OAuth flow (entire key without line breaks): -
----BEGIN PRIVATE KEY-----MIG...EN-----END PRIVATE KEY-----
✅ Successfully updated AdminQueriese13453b3 function locally
✅ Successfully updated AdminQueries API locally
✅ Successfully updated auth resource iris1ef6f127 locally
✅ Some next steps:
"amplify push" will build all your local back...
✅ Successfully updated resource update locally
✅ Some next steps:
"amplify push" will build all your local back...
tenna@chuurikitennanoiMac Iris % amplify push
⠧ Fetching updates to backend environment: dev from the cloud.⠋ Building resourc⠋ Building resource api/iris
⚠️ WARNING: your GraphQL API currently allows public create, read, update, and delete access to all models via an API Key. To configure PRODUCTION-READY authorization rules, review: https://docs.amplify.aws/cli/graphql/authorization-rules
⠴ Building resource api/iris✅ GraphQL schema compiled successfully.
Edit your schema at /Users/tenna/Desktop/Iris/amplify/backend/api/iris/schema.graphql or place .graphql files in a directory at /Users/tenna/Desktop/Iris/amplify/backend/api/iris/schema
✔ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
┌──────────┬──────────────────────┬───────────┬───────────────────┐
│ Category │ Resource name │ Operation │ Provider plugin │
├──────────┼──────────────────────┼───────────┼───────────────────┤
│ Auth │ iris1ef6f127 │ Update │ awscloudformation │
├──────────┼──────────────────────┼───────────┼───────────────────┤
│ Auth │ userPoolGroups │ No Change │ awscloudformation │
├──────────┼──────────────────────┼───────────┼───────────────────┤
│ Function │ AdminQueriese13453b3 │ No Change │ awscloudformation │
├──────────┼──────────────────────┼───────────┼───────────────────┤
│ Api │ AdminQueries │ No Change │ awscloudformation │
├──────────┼──────────────────────┼───────────┼───────────────────┤
│ Api │ iris │ No Change │ awscloudformation │
└──────────┴──────────────────────┴───────────┴───────────────────┘
✔ Are you sure you want to continue? (Y/n) · yes
Deployment completed.
Deploying root stack Iris [ =================================------- ]
amplify-iris-dev-bc369 AWS::CloudFormation::Stack UPDATE_
apiiris AWS::CloudFormation::Stack UPDATE_
authiris1ef6f127 AWS::CloudFormation::Stack UPDATE_
authuserPoolGroups AWS::CloudFormation::Stack UPDATE_
functionAdminQueriese13453b3 AWS::CloudFormation::Stack UPDATE_
apiAdminQueries AWS::CloudFormation::Stack UPDATE_
Deployed auth iris1ef6f127 [ ========================================
HostedUICustomResource AWS::Lambda::Function CREATE_
HostedUIProvidersCustomResour… AWS::Lambda::Function CREATE_
HostedUICustomResourcePolicy AWS::IAM::Policy CREATE_
HostedUIProvidersCustomResour… AWS::IAM::Policy CREATE_
HostedUICustomResourceLogPoli… AWS::IAM::Policy CREATE_
HostedUIProvidersCustomResour… AWS::IAM::Policy CREATE_
Deployed auth userPoolGroups [ =======================================
Deployment state saved successfully.
GraphQL transformer version: 2
Hosted UI Endpoint: https://iris26e476...
Test Your Hosted UI Endpoint: https://iris26e4...
5. Update a Service ID (Add Domains starting with iris26..., Return URLs starting with https://iris26.../oauth2/idpresponse)
6. Add these to the info.plist file
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>iris</string>
</array>
</dict>
</array>
7. Launch the app and tap the AppleSignInButton.
SignInWithAppleButton(.signUp)
{ request in
request.requestedScopes = [.fullName, .email]
} onCompletion: { authResults in
switch authResults {
case .success(let authResults):
self.signInWithApple(authResults: authResults)
case .failure(let error):
print(error.localizedDescription)
}
}
...
func signInWithApple(authResults: ASAuthorization) {
print("signInWithApple")
guard let appleIDCredential = authResults.credential as? ASAuthorizationAppleIDCredential else {
print("Failed to get AppleID credentials")
return
}
guard let identityTokenData = appleIDCredential.identityToken,
let identityToken = String(data: identityTokenData, encoding: .utf8) else {
print("Unable to fetch identity token")
return
}
Task {
if let fullName = appleIDCredential.fullName {
//self.givenName = fullName.givenName ?? ""
self.familyName = fullName.familyName ?? ""
}
self.email = appleIDCredential.email ?? ""
var result = try await Amplify.Auth.signInWithWebUI(for: .apple, presentationAnchor: UIWindow())
if result.isSignedIn {
isSignedIn = result.isSignedIn
}
}
}
8. Get the error.
Expected behavior
Be able to Sign in with Apple
Amplify Framework Version
2.39.0
Amplify Categories
Auth
Dependency manager
Swift PM
Swift version
latest
CLI version
12.12.6
Xcode version
Xcode 15.4 Build version 15F31d
Relevant log output
<details>
<summary>Log Messages</summary>
signInWithApple
Starting execution for Auth.socialWebUISignInAPI
Check if authstate configured
Auth state configured
Wait for a valid state
Start signIn flow
Sending cancel signIn
Wait for signIn to cancel
Failed execution for Auth.socialWebUISignInAPI with error:
AuthError: Make sure that the amplify configuration passed to Auth plugin is valid
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
iOS 17
Device
iPhone 11 & 15
Specific to simulators
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
authIssues related to the Auth categoryIssues related to the Auth categoryquestionGeneral questionGeneral question