Hi,
i Just update my ionic app with android version 7.0.0 then I found that all of my code that use Http request with Authorization header cannot request.
Here is my code
getWithAuthorize(url: string, options?): Promise<any> {
return this.storage.get('accessToken').then((token)=>{
let headers = new Headers({ 'Content-Type': 'application/json' })
headers.append('Authorization', 'Bearer '+token)
let option = new RequestOptions({ headers: headers })
return new Promise((resolve, reject) => {
this.http.get(url, option, )
.map(res => res.json())
.subscribe(
data => { resolve(data) },
(err) => {
this.handleErrorObservable({"_body":{message:"เกิดข้อผิดพลาด กรุณาลองใหม่"}})
resolve(err)
}
)
})
})
}
at the same code, I test on iOS, it works fine. So I don’t this problem is about android version?
Anyone face the same issue, please share
my info is
Ionic:
ionic (Ionic CLI) : 4.3.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.0.0, browser 5.0.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.2.0, (and 26 other plugins)
System:
ios-deploy : 1.9.2
ios-sim : 6.0.0
NodeJS : v8.12.0 (/usr/local/bin/node)
npm : 6.4.1
OS : macOS
Xcode : Xcode 10.1 Build version 10B61