Trying to update a chrome extension but get a "OAuth token is missing"

Hi
Can someone help ?
I changed everything relative to kraken API but I still have this error.

Here is my background.js :

var audio = new Audio(“sounds/pull-out.ogg”);

function pushNotification(id, title, message, iconUrl) {

** chrome.notifications.create(id, {**
** type: “basic”,**
** title: title,**
** message: message,**
** iconUrl: iconUrl**
** });**
}

function checkStream(){
** $.ajax({**
** type: “GET”,**
** dataType: “json”,**
** cache: false,**
** url: “https://api.twitch.tv/helix/streams/” + “?user_id=” + config.user_id,**
** headers: {**
** 'Client-ID: ****************’,
** 'Authorization: Bearer *******
** }

** success : function(data){

** if (data.stream != null) {

** chrome.browserAction.setBadgeText({text: “LIVE”});

** chrome.browserAction.setBadgeBackgroundColor({color: config.default_color});

** chrome.browserAction.setTitle({title: config.name + " - Online"});

** if (!alreadyCheck) {**
** pushNotification(config.name, "Hey, I’m online - " + data.stream.channel.display_name, “I’m playing “+ data.stream.channel.game +”, join me on twitch.”, “img/icon_128.png”);**
** audio.play();**
** alreadyCheck = true;**
** }**

** }else{**
** chrome.browserAction.setBadgeText({text: “”});**
** chrome.browserAction.setTitle({title: config.name + " - Offline"});**
** }**
** }**
** });**
}

checkStream();
setInterval(checkStream, 1200);

Thank’s !

Helix requires a token to call it

You don’t have a token.

For a browser extension the likely accepted authentication method is implcit auth: Getting Tokens: OAuth | Twitch Developers

Thank’s for your answer.
I already checked the doc but I’m not a dev and I’m not sure about what I should do.

I also have a config.js with

var config = {
name: “",
user_id: "
”,
clientID: “****************”, //
default_color: “#c23131”,
token:"**************************",
headers: {
‘Authorization’: Bearer ${token},
‘Client-ID’: clientId

The bearer shouldn’t be hardcoded as it will expire.

Either the token is invalid, expired, or it’s not passing to your ajax function as you expect.

So debug it

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