我正在使用 angular-oauth2-oicd 请求用户授予对其 basecamp3 帐户的访问权限。应用程序很好地加载了访问请求,但是当用户单击授予访问权限时,它不会重定向回 index.html 页面。它除了刷新页面什么都不做。我尝试了很多东西,但无济于事。
app.component.ts
export const authConfig: AuthConfig = {
loginUrl: 'https://launchpad.37signals.com/authorization/new',
issuer: 'https://launchpad.37signals.com/authorization/token',
redirectUri: "localhost:8080/index.html",
clientId: 'aeea63b486afddecf570c500e0ad54c0dd1be7da',
clearHashAfterLogin: false,
customQueryParams: {
'type': 'web_server'
}
};
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'ng-secure';
constructor(private oauthService: OAuthService) {
this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.loadDiscoveryDocumentAndTryLogin();
}
login() {
this.oauthService.initImplicitFlow(encodeURIComponent('localhost8080/index.html'));
}
logout() {
this.oauthService.logOut();
}
get givenName() {
const claims = this.oauthService.getIdentityClaims();
if (!claims) {
return null;
}
return claims['name'];
}
}