Open ap-h opened 5 months ago
Hi @ap-h - thanks for reaching out.
This sounds like it's more of SAML related issue rather than AWS SDK. I'm able to run the SDK code that you shared successfully. Upon doing some research on the error, the culprit might be the metadata mismatch between SAML response and Cognito User Pool metadata. It could also be SAML attribute mapping. Is there a way for you to compare successful and failed SAML assertions?
I'm not sure what your workflow setup looks like but I'd be happy to duplicate similar setup and try to reproduce it on my end, if you can share step-by-step repro.
Here are some resources that might be useful:
Hope it helps!
Hi @aBurmeseDev thank you for getting back to me and share the links!
The SDK and CDK codes work fine, but we get the error when we test SSO login in UI. We get the following error: SAML Assertion signature is invalid
However if we just submit the Hosted UI without changes then it works. This is the confusing part.
When I search "SAML Assertion signature is invalid" in Google it just returns 8 results that are totally unrelated. I checked all links you shared but they are different error messages, am I missing something?
Sorry I'm not sure what you mean by: compare successful and failed SAML assertions
Happy to provide the details you want if you can tell me what I need to do.
This is an example SAML file we use (masked values):
```xml
Checkboxes for prior research
Describe the bug
Hi, when we add a new SAML identity provider to cognito user pool client and user try to login via application UI we get this error (added to the callback url):
https://callback.url/?error_description=Invalid+SAML+response+received%3A+SAML+Assertion+signature+is+invalid.+&error=server_error
Decoded error:
Error: Invalid SAML response received: SAML Assertion signature is invalid.
But when we go to the AWS console > cognito user pool > App integration > App client > Click client > Edit Hosted UI > Just save without changes then it works fine.
The code we use to create SAML identity provider and add it to the client:
This is the CDK code how we create user pool and client:
SDK version number
@aws-sdk/client-cognito-identity-provider@3.583.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node 18
Reproduction Steps
Please use the code in the description to reproduce it.
Observed Behavior
Getting this error in UI after redirected from Azure login:
Error: Invalid SAML response received: SAML Assertion signature is invalid.
This is logged in console by amplify but also I can se the error added to the callback url.Expected Behavior
No error
Possible Solution
Currently the workaround is to manually go to AWS cognito console and just Edit > Save the hosted UI of the user pool client without any changes.
Additional Information/Context
No response