Troubleshooting /oauth/token endpoint

@tyf - I worked it out.

The problem was that I was using the incorrect mode.

So instead of:

body: {
      mode: 'formdata',
      formdata: 
        [
            {key: "grant_type", value: "password"},
            {key: "username", value: username},
            {key: "password", value: password},
            {key: "audience", value: audience},
            {key: "scope", value: "profile"},
            {key: "client_id", value: client_id},
            {key: "client_secret", value: client_secret}
        ]
      
    }

I needed to use

body: {
      mode: 'urlencoded',
      urlencoded: 
        [
            {key: "grant_type", value: "password"},
            {key: "username", value: username},
            {key: "password", value: password},
            {key: "audience", value: audience},
            {key: "scope", value: "openid profile"},
            {key: "client_id", value: client_id},
            {key: "client_secret", value: client_secret}
        ]
      
    }
1 Like