I’m working with angular 8.0.2 and i encountered this issue.
import { Component, OnInit } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'TwitchApp';
constructor(private http: HttpClient){};
ngOnInit(){
const headers = new HttpHeaders().set('Client-ID','jcsbzv9nubttnt7i54nrqh95xht4yn');
this.http.get('https://api.twitch.tv/kraken/streams/224975512',{headers}).subscribe((data =>{
console.log(data);
}));
}
}
On the browser consoel it shows me:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.twitch.tv/kraken/streams/224975512. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘*, *’).
thanks