2 Replies Latest reply on Sep 1, 2020 12:59 PM by Andrew Waters

    Node.js /api/token Unsupported grant type

    Aaron Taylor
      Share This:

      Hi all,


      I'm trying to authenticate using the /api/token endpoint for Discovery via Node.js (Express), but I seem to have hit a wall.

      I keep getting a 400 error that says the grant type is unsupported, even though I'm fairly certain I have it formatted correctly.


      Here is the POST request I am making:


           const { data } = await axios({
                method: 'post',
                headers: {
                     'Authorization': 'Basic "+creds //username:password encoded in base 64
                     'Content-Type': 'x-www-form-urlencoded'
                url: URL,
                httpsAgent: httpsAgent,
                body: 'grant_type=password' // Main issue


      Thank you