akveo / akveo/nebular

OpenIddict grant_type password doesn't require client_secret

未关闭
#3,174 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
8.1k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

### Issue type

* [X] feature request
* [ ] bug report

### Issue description

**Current behavior:**
When requesting a token from from /connect/token using NbOAuth2ClientAuthMethod.REQUEST_BODY in payload it sends:
username, password, scope?,client_id and client secret
I get this response: The 'client_secret' parameter is not valid for this client application.
**Expected behavior:**
I suggest adding a new NbOAuth2ClientAuthMethod which will allow us to get the access_token without sending client_secret because right now if I don't include the client_secret in my configuration I get this error in browser's console: "For request body client authentication method, please provide both clientId & clientSecret"

**Steps to reproduce:**
Use NbOAuth2AuthStrategy and openIddict in the backend and try to get the token from /connect/token

**Related code:**
```
protected addCredentialsToParams(params: any): any {
if (this.clientAuthMethod === NbOAuth2ClientAuthMethod.REQUEST_BODY) {

///this line in oauth-strategy.ts checks for clientSecret

if (this.getOption('clientId') && this.getOption('clientSecret')) {
return {
...params,
client_id: this.getOption('clientId'),
client_secret: this.getOption('clientSecret'),
};
} else {
throw Error('For request body client authentication method, please provide both clientId & clientSecret.');
}
}
return params;
}
```
### Suggestion:

```
protected addCredentialsToParamsOpenIddict(params: any): any {
if (this.clientAuthMethod === NbOAuth2ClientAuthMethod.REQUEST_BODY_OPENIDDICT) {
if (this.getOption('clientId')) {
return {
...params,
client_id: this.getOption('clientId')
};
} else {
throw Error('For request body client authentication method, please provide clientId');
}
}
return params;
}```

**Angular, Nebular**
Abp 6, Angular 14, nebular 10

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。