Hi I’m getting the next error:
Access to XMLHttpRequest at ‘https://firebasestorage.googleapis.com/v0/b/blabla.svg?alt=media&token=468c56’ from origin ‘http://localhost:8100’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
running my codewith ionic serve or ionic serve -l
the code is:
import { Injectable } from '@angular/core';
import { AngularFireStorage } from '@angular/fire/storage';
import { Observable } from 'rxjs';
import { HTTP } from '@ionic-native/http/ngx';
import { HttpClientModule, HttpClient } from '@angular/common/http';
@Injectable({
providedIn: 'root'
})
export class FirebaseSTService {
meta: Observable<any>;
constructor(
private fbStorage: AngularFireStorage,
private httpNative: HTTP,
private httpClient: HttpClient) {
}
getFile() {
const ref = this.fbStorage.ref('catalog/urology/kidney_cancer/urology_kidney_cancer_diagnostic_2018_r_1_0.svg');
let metadata = ref.getMetadata().subscribe(data => {
console.log(data);
})
ref.getDownloadURL().subscribe(data => {
console.log(data);
// this.httpNative.get(data, {}, {}).then( value => {
// console.log(value);
// })
this.httpClient.get(data).subscribe(response => {
console.log(response);
})
});
}
}
I’ve googled a lot and tried a lot of things but the solutions I’ve found seems to be for ionic versions < 4
Any help?