Hello, I am encountering an issue specifically when making a post request rather than a get request.
The authorization for this particular request has been denied.
Interestingly, this function works perfectly fine with my WPF APP and even on Postman. Based on this observation, I suspect there might be an error in my typescript call.
postRequest(url: string, body:any): Observable<any> {
let options = this.generateOptions(body);
this.includeJsonHeaders(options.headers);
return this.http.post(this.appConfig.baseRoute + url, options);
}
private generateOptions(body?:any): RequestOptions {
let headers = new Headers();
headers.append('Authorization', `${this.sessionService.session.token_type} ${this.sessionService.session.access_token}`);
let options = new RequestOptions({ headers: headers });
if (body !== undefined) {
options.body = body;
}
return options;
}
private includeJsonHeaders(headers: Headers): void {
headers.append('Content-Type','application/json');
}
Could you kindly assist me in identifying where I may have gone wrong with my request?
For your information, I am utilizing Owin alongside Web API.