Legacy Dev Forum Posts

 View Only

Sign Up

Get token from .NET desktop client using PostTokenSaml2Bearer

  • 1.  Get token from .NET desktop client using PostTokenSaml2Bearer

    Posted 06-05-2025 18:22

    Thomas_Rasmussen | 2022-04-08 12:55:49 UTC | #1

    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, "<Client id>", "<Client secret>", "<organisation>", 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?


    system | 2022-05-09 12:56:20 UTC | #2

    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: 14246