I am trying to retrieve contacts from Google within an Angular 4 Universal app.
But I receive this error message once authentication has been done:
Refused to execute script from https://www.google.com/m8/feeds/contacts/default/full?access_token=TOKEN&alt=json because its MIME type ('application/json') is not executable, and strict MIME type checking is enabled.
At the moment everything is held in one Component:
import { Component, OnInit } from '@angular/core';
import { Jsonp } from '@angular/http';
@Component({
selector: 'refer-friend',
templateUrl: './referFriend.component.html',
})
export class ContactsComponent implements OnInit {
constructor(private jsonp: Jsonp) { }
ngOnInit(): void {
this.auth();
}
auth() {
gapi.auth.authorize({
'client_id': 'CLIENTID.apps.googleusercontent.com',
'scope': 'https://www.google.com/m8/feeds'
}, () => {
this.fetch(gapi.auth.getToken());
});
}
fetch(token: any) {
this.jsonp.get('https://www.google.com/m8/feeds/contacts/default/full?access_token=' + token.access_token + '&alt=json')
.map(data => {
return data;
})
.subscribe(data => {
console.log(data);
});
}
}
I got the code from this sample which works fine without this error happening. So I can only guess Angular is effecting something....