Api-Token Invalid

Hi @Woo , I’m getting the followking error when calling the rooms end point https://api-{key}.calls.sendbird.com/v1/rooms/{room}.

message: 'The Api-Token specifies invalid value. Check your api token.',
code: 400100,
type: 'INVALID_PARAMS'

It seems however that this is only happening when I deploy to production ie. it is not happening on my localhost. I am definitely sending the Api-Token as I can see this being set in the headers, and it’s working locally. I also tried setting the domains in the dashboard, but this seemed to have to effect.

I’m using axios to call, so I’m not sure if it’ messes with the headers, but again, not sure why this would be showing up only when deployed

axios.get(`https://api-${process.env.SENDBIRD_APP_ID}.calls.sendbird.com/v1/rooms/${doc.data().value}`, { headers: { 'Api-Token': process.env.SENDBIRD_API_TOKEN }})

so are you using same token when you calling the endpoint both local and production? please dm me your application id and I will check on server log

Hi Mark,
Did you use right API token for the app?

yeah definitley the same token @imju but I’m wondering if the headers are case sensitive and something isbneing mangled. I’m still trying to investigate. @Woo will DM you

headers should be case insensitive. Are there any code difference between local and production?

@woo I think I’ve figured it out. It’s actually the webpack build step that’s mangling the token in some way, but his only happens in prod. I can fix the issue by hardcoding the value, so the api is actually working as expected. Sorry for the hassle and thanks for jumping on this so quickly.

1 Like