I want to write in Angular Typescript this request:
http://localhost:8080/engine/oauth/authorize?client_id=admin&redirect_uri=http://localhost:9000/callback&response_type=code&scope=read_profile
When I open this link into the web browser I get redirection response:
http://localhost:9000/callback?code=7CLwgh
I tried to write this Typescript code:
authCodeRequest(name: string, password: string): Observable<any> {
const body = new HttpParams()
.set('client_id', 'admin')
.set('redirect_uri', 'http://localhost:9000/callback')
.set('response_type', 'code')
.set('scope', 'read_profile');
const headers = new HttpHeaders({
'Content-Type': 'application/x-www-form-urlencoded',
});
return this.httpClient
.get(environment.api.urls.auth.token, body.toString(), {
headers
})
.pipe(
map((response: Authorize) => {
console.log(data)
return true;
})
);
}
I get this error for the get request: TS2554: Expected 1-2 arguments, but got 3.
What is the proper way to make a request and get the result from the redirected link param code
?