angular - 用户授予访问权限后,angular-ouath2-oidc 不重定向
问题描述
我正在使用 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'];
}
}
解决方案
我想通了为什么它不会重定向。
oauth 客户端不允许重定向到 localhost。必须是公共 ip 或实际域名。
推荐阅读
- excel - 有没有办法在 Azure Blob 存储中将 .xlsx 文件转换为 .csv 文件格式?
- node.js - Lambda 代码适用于 node v8.10 但不适用于 nodejs v10.x
- c - 如何停止打印有条件的字符串?
- python - 如何获得键值等于函数参数?
- python - 如何使用'select_related'从相关(ForeignKey)django模型中接收并非所有字段
- java - 如何从 sql 准备语句中删除单引号
- sql - 查询列包含特定单词的所有列不起作用?
- c++ - 限制整数的 istream 读取宽度
- mysql - 有什么方法可以禁用特定 mysql 数据库的区分大小写选项,直到下次重新启动?
- google-apps-script - 使用 getRangeList 导入范围