akveo / akveo/ngx-admin

NbOAuth2AuthStrategy show errors from login response

未关闭
#6,010 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
25.7k
派生
7.9k
PR 合并指标
30 天内没有已合并 PR

描述

### Issue type

* [ ] bug report
* [X] feature request
* [ ] question about the decisions made in the repository

### Issue description

I have setup a login through Keycloak. When I login with wrong credentials, I do see Keycloak responding with "Invalid credentials". I would like to display this error, but "Something went wrong" is always shown. How can I show the error coming from Keycloak? I have already checked similar issues like #442 and #1835 but there is no "errors" property in the NbOAuth2AuthStrategy setup.

**Current behavior:**
When I login with invalid credentials, the error "Something went wrong" is shown.

**Expected behavior:**
The error in the login response should be shown

**Steps to reproduce:**
Login with invalid credentials using the NbOAuth2AuthStrategy

**Related code:**

```ts
NbOAuth2AuthStrategy.setup({
name: 'keycloak',
baseEndpoint: environment.keycloak.uri,
clientId: environment.keycloak.client_id,
clientSecret: environment.keycloak.client_secret,
clientAuthMethod: NbOAuth2ClientAuthMethod.BASIC,
authorize: {
endpoint: '/auth',
responseType: NbOAuth2ResponseType.TOKEN,
},
token: {
endpoint: '/token',
grantType: NbOAuth2GrantType.PASSWORD,
class: NbAuthOAuth2JWTToken,
},
refresh: {
endpoint: '/token',
grantType: NbOAuth2GrantType.REFRESH_TOKEN,
},
})
```

### Other information:

```
node v14.21.3
```

**Angular, Nebular**
```
Angular 13.3.12
Nebular 9.1.0-rc.8
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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