pla*_*one 5 oauth-2.0 angular angular-oauth2-oidc pkce
我正在使用 angular-oauth2-oidc 进行身份验证,但我不知道如何获取访问令牌。我正在使用具有此配置的 PKCE 代码流
authConfig: AuthConfig = {
issuer: 'https://test.com/oauth/token',
// requireHttps: false,
redirectUri:'http://localhost:4200/',
strictDiscoveryDocumentValidation: false,
tokenEndpoint: 'https://test.com/oauth/token',
clientId: 'test',
// dummyClientSecret: 'test',
scope: 'openid',
oidc: true,
responseType: 'code',
showDebugInformation: true,
requestAccessToken: true
};
Run Code Online (Sandbox Code Playgroud)
流程是使用此代码启动的,登录后它会被重定向,但我无法获得任何令牌。
getAutherizationCodeWithPKCE() {
this.oauthService.configure(this.authConfig);
this.oauthService.initCodeFlow();
this.oauthService.loadDiscoveryDocumentAndTryLogin
}
Run Code Online (Sandbox Code Playgroud)
通过在上面的示例中发送客户端密钥解决了问题
dummyClientSecret: 'test',
Run Code Online (Sandbox Code Playgroud)
我正在使用 Cloud Foundry 授权服务器,它似乎需要客户端密钥。然后可以轻松获得访问令牌
this.oauthService.getAccessToken()
Run Code Online (Sandbox Code Playgroud)
版本:
angular 13.1.2
angular-oauth2-oidc 13.0.1
cloud foundry uaa 75.11.0
Run Code Online (Sandbox Code Playgroud)
我不会删除这个问题,以防将来有人遇到同样的问题。
| 归档时间: |
|
| 查看次数: |
9791 次 |
| 最近记录: |