Some API calls impossible with Angular

Now it’s required to use cliend ID when I try to request all emoticons with this method:
https://github.com/justintv/Twitch-API/blob/master/v2_resources/chat.md#get-chatemoticons

When I try to do http request this with Angular I’m getting CORS errors, because custom headers presents in request, Angular make OPTIONS request and getting CORS error.

So, custom header of course is Client-ID. Try to execute this http request in your Angular code and see what happen.

$http({method: 'GET', url: 'https://api.twitch.tv/kraken/chat/emoticons', headers: {
    'Client-ID': 'your-client-id'}
}).then(function(res){
    console.log(res.data);
});

You will get CORS errors and no data.
What am I doing wrong? How can I fix this? Thank you!

GET /chat/emoticons is old and shouldn’t be used anymore. I’m surprised it hasn’t been removed yet or at least marked as deprecated in the docs. You will want to migrate to GET /chat/emoticon_images.

https://github.com/justintv/Twitch-API/blob/master/v3_resources/chat.md#get-chatemoticon_images

Yes, this method is working withoud “client_id” header, but should this header present?
Old method confused me so much. Thank you a lot!

I noticed emoticon_image works without the client ID as well. Either way best to send it anyway in case it changes in the future.

Usage of emoticon_image without client ID is limited. It’s wotk fine woth client ID without that limit. Thanks!

See Client-ID Requirement FAQs for the whole Client-ID required things.

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