Legacy Dev Forum Posts

 View Only

Sign Up

Cannot get access token after getting SAML assertion

  • 1.  Cannot get access token after getting SAML assertion

    Posted 06-05-2025 19:24

    Magudeeswaran_N | 2023-06-20 05:37:36 UTC | #1

    Hi team,

    I got SAML assertion from Microsoft AD but I am passing it to get access token and its throwing me "invalid request" error.

    nodejs code:

    app.post('/saml', function (req, res) { console.log("reponse from Azure AD", req.body); var assertion = req.body.SAMLResponse; console.log("assertion from AD", assertion); var encodedData = new Buffer.from(process.env.GENESYSCLOUDCLIENTID + ':' + process.env.GENESYSCLOUDCLIENTSECRET).toString('base64');

    let config = { method: "post", url: 'https://login.mypurecloud.com/oauth/token', host: 'http://localhost:1363/', headers: { "Content-Type": "application/x-www-form-urlencoded", "Authorization": 'Basic ' + encodedData }, 'body': { 'grant_type': 'urn:ietf:params:oauth:grant-type:saml2-bearer', 'orgName': 'hexawaretechnologieslimited', 'assertion': assertion

    }, 'mode': 'cors', }

    axios(config) .then(function (response) { //handle success console.log("response from Genesys token--------", response); }) .catch(function (response) { //handle error console.log(response); });

    can you please tell what is wrong with above reqiest.


    system | 2023-07-21 05:37:48 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: 20541