I am using angular-oauth2-oidc to obtain PKCE flow, but when I call api from resource server, it seem to be not send access_token in the header. I try to check angular-oauth2-oidc get access_token or not but I don't see anything
I think the library will send access_token to http://localhost:8080 right ?
@NgModule({
declarations: [
AppComponent,
HomeComponent,
LoginComponent
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
OAuthModule.forRoot({
resourceServer: {
allowedUrls: ['http://localhost:8080'],
sendAccessToken: true
}
})
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
I am using initCodeFlow();
export class LoginComponent {
title = 'for-south-ui';
constructor(private oauthService: OAuthService, private loginService: LoginService, private oAuthStorage: OAuthStorage) {
this.configure();
}
authConfig: AuthConfig = {
issuer: 'http://localhost:9090/realms/for-south-app',
redirectUri: window.location.origin,
clientId: 'for-south-ui',
scope: 'openid profile email',
responseType: 'code',
showDebugInformation: true,
requestAccessToken: true,
dummyClientSecret: 'test'
}
public login() {
this.loginService.login();
}
public logoff() {
this.loginService.logout();
}
public getAccessToken() {
console.log(this.oAuthStorage.getItem('localStorage'));
}
private configure() {
this.oauthService.configure(this.authConfig);
this.oauthService.tokenValidationHandler = new NullValidationHandler();
this.oauthService.loadDiscoveryDocumentAndTryLogin();
this.oauthService.setStorage(this.oAuthStorage);
}
this is request that I sent to resource server
export class TopicService {
private url = "http://localhost:8080/api/v1/topic/test";
constructor(private httpClient: HttpClient) {}
public getTest(): Observable<any> {
return this.httpClient.get<any>(this.url);
}