Get token from .NET desktop client using PostTokenSaml2Bearer

We have created a .NET desktop client application and want to get a token using SAML2 Bearer. We have created an OAuth integration in Genesys Cloud of the type SAML2 Bearer and have followed the documentation (https://developer.genesys.cloud/authorization/platform-auth/use-saml2-bearer#requesting-an-access-token), but whenever we are requesting a token we get the message:

"Error calling PostToken: {"error":"invalid_request"}"

In code we are doing the following:
var saml = "<saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID=" ... </saml:Assertion>";
var assertion = Convert.ToBase64String(Encoding.GetEncoding("ISO-8859-1").GetBytes(saml));
var accessTokenInfo = Configuration.Default.ApiClient.PostTokenWithHttpInfoSaml2Bearer(Configuration.Default.ApiClient, "", "", "", assertion);

We have tried using both of the methods 'PostTokenSaml2Bearer' and 'PostTokenWithHttpInfoSaml2Bearer', but get the same exceptions.

As we are requesting the token from a .NET desktop client application we do not have an "Authorized redirect URI", which is why we have simply configured a random localhost URI "https://localhost:8181" on the OAuth integration.

What are we missing? Why are we not getting a token in response to our request?

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.