我在我的本地服务器上设置了一个在http://localhost:4200
上运行的角度应用程序。我使用Okta-signin-widget作为身份验证。提交登录表单时,我在控制台中收到以下错误:
error.errorCode: invalid_request, error.description: The 'redirect_uri' parameter
must be an absolute URI that is whitelisted in the client app settings.
我用谷歌搜索,但我发现在Okta的开发者控制台中将http://localhost:4200
添加到API>Trusted Origins
,但这没有帮助(它已经定义)。
我在Okta应用程序设置中有以下内容:
Login redirect URIs: http://localhost:4200/implicit/callback
http://localhost:4200/urlform
并在角度登录代码中定义了重定向URI,如下所示:
this.widget.renderEl({
el: '#okta-signin-container'},
(res) => {
if (res.status === 'SUCCESS') {
this.signIn.loginRedirect('http://localhost:4200/urlform', { sessionToken: res.session.token });
// Hide the widget
this.widget.remove();
}
},
(err) => {
throw err;
}
);
但同样的问题。我不确定我是否在正确的页面上工作。
任何想法都非常感谢。
将http://localhost:4200
添加到您的应用程序的登录重定向URI列表中,它应该可以解决问题。