After receiving a response, I am attempting to save a token in session storage. However, when I try to compile this code, I encounter an error stating 'Property 'access_token' does not exist on type 'Object'. This error appears before sending a request, but my goal is to execute session storage after receiving a response rather than before sending the request.
this.http.post(url,null,
{
headers : new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization' :'Basic '+ btoa('username:password')
})
}
).subscribe(
data => { // json data
console.log('Success: ', data);
sessionStorage.setItem("Token ",data.access_token)
},
error => {
console.log('Error: ', error);
}
)
}