[SOLVED] Status: 400, message: 'missing client secret'

Hi,

Occasionally I need to do a few queries, and so far it worked fine but I have read that they have implemented oauth token, now i need the oauth token…

I am using nodejs and I have tried to request it but it gives me error “missing client secret”.

My code is this and I don’t know what I’m doing wrong.

axios({
  method: 'POST',
  url: 'https://id.twitch.tv/oauth2/token',
    headers: {
      'client-id': 'code client id',
      'clien_secret': 'code secret'
    }
})

Result: data: { status: 400, message: ‘missing client secret’ }

Put the data in query params, not headers

1 Like

You also misspelt client_secret and client-id should be client_id and ommitted the grant_type

axios({
  method: 'POST',
  url: 'https://id.twitch.tv/oauth2/token?client_id=foo&client_secret=bar&grant_type=client_credentials'
})
1 Like

Oh my god, what a silly mistake

Thank you very much, problem solved.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.