akveo / akveo/ngx-admin

Pass client id and client secret to token endpoint

Offen
#5,537 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
TypeScript
Sterne
25.7k
Forks
7.9k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

### Issue type

**I'm submitting a ...** (check one with "x")

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

### Issue description

**Current behavior:**
I have backend written in **Django** using `django oauth toolkit` to provide OAuth2 service.
But the authentication has no authorization flow and returns token directly when `username` and `password` is passed along with the `client_id` and `client_secret` as shown in the postman snippet.

https://ibb.co/wLBhhTw

I have the following strategy setup
```
NbOAuth2AuthStrategy.setup({
name: 'oauth',
baseEndpoint: `${environment.apiURL}auth/`,
clientId: `${environment.clientId}`,
clientSecret: `${environment.clientSecret}`,
clientAuthMethod: NbOAuth2ClientAuthMethod.BASIC,
redirect: {
success: '/',
failure: null,
},
token: {
endpoint: 'token/',
grantType: NbOAuth2GrantType.PASSWORD,
class: NbAuthSimpleToken,
},
}),
```

But the request has `client_id` and `client_secret` field missing.

The request payload has only following data
```
grant_type: password
username: test@example.com
password: test1234
```

The response I will get will be
```
{
"access_token": "cv8Zsl8mUhxDstYmmJgONZvuIMud7j",
"expires_in": 36000,
"token_type": "Bearer",
"scope": "read write groups",
"refresh_token": "4epusH6wKGDkgBbYiHKI6y5xGhQ1pY"
}
```

**Expected behavior:**

`client_id` and `client_secret` should be passed to the `token` endpoint as well.

**How can I add the `client_id` and `client_secret` to the payload and also handle the access token response?**

### Other information:

**npm, node, OS, Browser**
```
Node, npm: v10.15 and 6.12
OS: macOS (Catalina)
Browser: Chrome
```

**Angular, Nebular**
```
Angular: 8
Nebular: 4.1.2
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.