Herlander_Pires | 2017-10-19 17:48:12 UTC | #1
Hello,
I'm trying to request a token via SAML2 Bearer.
When i make a POST i get this response: { "error": "invalid_request", "description": "failed to parse assertion" }
I follow this link: https://developer.mypurecloud.com/api/rest/authorization/use-saml2-bearer.html
In the assertion=< Base64 encoded SAML Assertion > i try with the full saml response and only the assertion tab.
I saw this example https://github.com/MyPureCloud/saml2bearer-oauth-example/blob/master/server.js and they set the keys values in the form-data. Tried that but i have the same response without a description node.
Best regards.
Herlander Pires
tim.smith | 2017-10-23 14:56:44 UTC | #2
This error means one of two things:
- The base64 encoded value isn't encoded correctly. Try using a tool to validate that your encoded value can be decoded correctly, or that your raw value gets encoded to the same value as the tool creates. Here's one to try: https://www.base64decode.org/
- Your XML document is malformed. Try using a tool to validate the document you're sending. Here's one to try: https://www.w3schools.com/xml/xml_validator.asp
Herlander_Pires | 2017-10-24 10:01:36 UTC | #3
Hello Tim,
I can decode the response on that site and there are no errors validating in w3schools validator.
I'm using postman to make the request this way:
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/cdfa486cd4d0cfdf784e95661054e5f4fc8c5632.png" width="690" height="284">
<img src="//inin-prod-use1-developerforum.s3.amazonaws.com/original/1X/f4ef33e3ca9ab5dff296e3a423daed44d0f142a0.png" width="690" height="330">
Is this the correct way?
My Authorization is -> (myclientid):(myclientsecret) in Base64 And my assertion is the saml response
Thanks.
tim.smith | 2017-10-24 15:13:34 UTC | #4
It looks like your body is set to send as form-data, not x-www-form-urlencoded. Try that and see if it changes your outcome.
Herlander_Pires | 2017-10-24 16:30:05 UTC | #5
It works.
Thanks.
Best regards.
Herlander Pires
system | 2017-11-24 16:30:21 UTC | #6
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 1979