I'm working with ionic with capacitor and trying to pull a list files from a directory using the google drive api. I was able to pull a list of files on android but when I try to run on ios (using both an emulator and device) it gave me this error.
This is the code I'm using to hit that URI. Note I'm using a service account to auth my requests.
drive(access_token): Observable<Object> {
const headers = new HttpHeaders({
'Content-Type': 'application/json',
'Authorization': 'Bearer ' + access_token
})
return this.http.get("https://www.googleapis.com/drive/v3/files", { headers: headers }).pipe(
tap(data => data['files']),
catchError(this.handleError)
);
}
On my app I'm also hitting the google calendar api and I was able to pull information out of that so I know the access token is good.
I tried hitting on the uri with postman also and I was able to pull a list of files there. Not sure what's the issue here, happy with any input.
I ended up using a different http client, I originally was using angulars httpClient but switch to ionic native http client and i was able to hit the google drive endpoint.
https://ionicframework.com/docs/native/http