Skip to content

Commit b691078

Browse files
author
Crhistian Ramirez
committed
🐛 grant_type wrong for elevated login and client credentials
1 parent 32a6f6c commit b691078

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

codegen/templates/api/Auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Auth {
7373
scope: Array<SecurityProfile['Roles']>
7474
): Promise<AccessToken> {
7575
const body = {
76-
grant_type: 'client_credentials',
76+
grant_type: 'password',
7777
scope: scope.join(' '),
7878
client_id: clientID,
7979
username,
@@ -109,7 +109,7 @@ class Auth {
109109
scope: Array<SecurityProfile['Roles']>
110110
): Promise<AccessToken> {
111111
const body = {
112-
grant_type: 'password',
112+
grant_type: 'client_credentials',
113113
scope: scope.join(' '),
114114
client_id: clientID,
115115
client_secret: clientSecret,

src/api/Auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Auth {
7373
scope: Array<SecurityProfile['Roles']>
7474
): Promise<AccessToken> {
7575
const body = {
76-
grant_type: 'client_credentials',
76+
grant_type: 'password',
7777
scope: scope.join(' '),
7878
client_id: clientID,
7979
username,
@@ -109,7 +109,7 @@ class Auth {
109109
scope: Array<SecurityProfile['Roles']>
110110
): Promise<AccessToken> {
111111
const body = {
112-
grant_type: 'password',
112+
grant_type: 'client_credentials',
113113
scope: scope.join(' '),
114114
client_id: clientID,
115115
client_secret: clientSecret,

tests/auth.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ test('can auth with elevated login', async () => {
4747
testdata.scope as SecurityProfile['Roles'][]
4848
)
4949
expect(mockAxios.post).toHaveBeenCalledTimes(1)
50-
const body = `grant_type=client_credentials&scope=${urlencode(
50+
const body = `grant_type=password&scope=${urlencode(
5151
testdata.scope.join(' ')
5252
)}&client_id=${testdata.clientID}&username=${urlencode(
5353
testdata.username
@@ -66,7 +66,7 @@ test('can auth with client credentials', async () => {
6666
testdata.scope as SecurityProfile['Roles'][]
6767
)
6868
expect(mockAxios.post).toHaveBeenCalledTimes(1)
69-
const body = `grant_type=password&scope=${urlencode(
69+
const body = `grant_type=client_credentials&scope=${urlencode(
7070
testdata.scope.join(' ')
7171
)}&client_id=${testdata.clientID}&client_secret=${testdata.clientSecret}`
7272
expect(mockAxios.post).toHaveBeenCalledWith(testdata.authUrl, body, {

0 commit comments

Comments
 (0)