Hi All, Extension noob here. Ultimately I’d like to query my Extension users to get their display names. I understand I can do this once I’ve got my app access token. My EBS is on Firebase functions and I’ve already succeeded JWT signing for other functionailty, so my creds / IDs should be OK…
I’ve tried extracting the pertinent parts of the app access retrieval from here:
But the access_token in the fetch response is always undefined.
let token_url = new URL('https://id.twitch.tv/oauth2/token');
token_url.search = new URLSearchParams([
[ 'client_id', config.client_id ],
[ 'client_secret', config.client_secret ],
[ 'grant_type', 'client_credentials' ]
]).toString();
functions.logger.log('token_url ' , token_url );
functions.logger.log('token_url.search ' , token_url.search );
fetch(
token_url,
{
method: 'POST',
headers: {
'Accept': 'application/json'
}
}
).then(token_resp => {
functions.logger.log('response ' , token_resp );
let token_body = token_resp.json().then( respJson =>{
config.api_token = respJson.access_token;
functions.logger.log('Got a App Access Token', config.api_token);
functions.logger.log('Ready to start');
const resp = { "user_access_token" : config.api_token };
res.status(200).send(resp);
})
});
I’d be grateful for a steer!
Thanks!