0

I've been trying to connect to my MS Dynamics 365 on-premise server by sending api requests using NodeJS. I've been trying to find documentation and everything but there's only stuff thats authenticating with Azure.

I can easily connect it using browser login, but when I try to replicate the endpoints something weird happens with the cookies.

I tried it like this with simple axios app, but it just returns a html page.

const axios = require('axios')



const signIn = async () => {
    const data = await axios.post('https://example.com/adfs/ls/',
        {
            UserName: 'rand_username',
            Password: 'rand_pass',
            AuthMethod: 'FormsAuthentication'
        },
        {
            params: {
                wa: 'wsignin1.0',
                wtrealm: 'https://servicerooturl.com/rm=1&id=dd31da50-3313-482e-a08e-f61c5fb41aa5&ru=https://servicerooturl.com%2fmain.aspx&crmorgid=339b4e86-3581-ed11-a98e-005056310236',
                wct: '2023-01-18T15:25:58Z',
                wauth: 'urn:oasis:names:tc:SAML:1.0:am:password',
                'client-request-id': 's0merand-char-iddd-haaa-0280010c005d'
            }
        }
    )


    console.log(data);
}


signIn()
MikodanicI
  • 76
  • 5

0 Answers0