angular oidc库代码流没有发现文档



我们必须在Angular应用程序中实现oauth2代码流。到目前为止,我们已经使用了隐式流,没有任何问题,我们正在使用此库https://github.com/manfredsteyer/angular-oauth2-oidc.现在,对于代码流,我们没有任何可用的发现文档,因此库无法继续执行该流。是否有可能手动配置代码流的URL?我们使用的是该库的8.0.4版本,Angular版本是7。

谢谢!

授权代码遗留流(不带pkce(手动配置,无需发现文档-manfredsteyer/angular-oauth2-oidc。

他们将解决方案发布在:https://github.com/manfredsteyer/angular-oauth2-oidc/issues/1051.

jeroenheijmans的一些详细信息

*这是可能的,但您需要手动配置所有内容。跳过loadDiscoveryDocument。。。部件,而不是配置一切都在那个地方,然后像往常一样继续将

在#1051中,我想同样的问题也被问到了——https://github.com/manfredsteyer/angular-oauth2-oidc/issues/1051*

根据我的样本,你可以大致做这样的事情:

private configureWithoutDisovery(): Promise<void> {
// configure the library here, by hand, per your IDS settings
}
public runInitialLoginSequence(): Promise<void> {
return this.configureWithoutDisovery()
.then(() => this.oauthService.tryLogin())
.then(() => {
if (this.oauthService.hasValidAccessToken()) {
return Promise.resolve();
}
return this.oauthService.silentRefresh()
.then(() => Promise.resolve())
.catch(result => {
const errorResponsesRequiringUserInteraction = [ 'interaction_required', 'login_required', 'account_selection_required', 'consent_required' ];
if (result && result.reason && errorResponsesRequiringUserInteraction.indexOf(result.reason.error) >= 0) {
console.warn('User interaction is needed to log in, we will wait for the user to manually log in.');
return Promise.resolve();
}
return Promise.reject(result);
});
})
.then(() => {
this.isDoneLoadingSubject$.next(true);
// optionally use this.oauthService.state to route to original location
})
.catch(() => this.isDoneLoadingSubject$.next(true));
}

最新更新