diff --git a/packages/bruno-lang/v2/src/jsonToBru.js b/packages/bruno-lang/v2/src/jsonToBru.js index 51f01e88a..547fe380f 100644 --- a/packages/bruno-lang/v2/src/jsonToBru.js +++ b/packages/bruno-lang/v2/src/jsonToBru.js @@ -196,8 +196,8 @@ ${indentString(`token_placement: ${auth?.oauth2?.tokenPlacement || ''}`)}${ }${ auth?.oauth2?.tokenPlacement !== 'header' ? '\n' + indentString(`token_query_key: ${auth?.oauth2?.tokenQueryKey || ''}`) : '' } -${indentString(`auto_fetch_token: ${(auth?.oauth2?.autoFetchToken).toString()}`)} -${indentString(`auto_refresh_token: ${(auth?.oauth2?.autoRefreshToken).toString()}`)} +${indentString(`auto_fetch_token: ${auth?.oauth2?.autoFetchToken?.toString?.()}`)} +${indentString(`auto_refresh_token: ${auth?.oauth2?.autoRefreshToken?.toString?.()}`)} } `; @@ -221,8 +221,8 @@ ${indentString(`token_placement: ${auth?.oauth2?.tokenPlacement || ''}`)}${ }${ auth?.oauth2?.tokenPlacement !== 'header' ? '\n' + indentString(`token_query_key: ${auth?.oauth2?.tokenQueryKey || ''}`) : '' } -${indentString(`auto_fetch_token: ${(auth?.oauth2?.autoFetchToken).toString()}`)} -${indentString(`auto_refresh_token: ${(auth?.oauth2?.autoRefreshToken).toString()}`)} +${indentString(`auto_fetch_token: ${auth?.oauth2?.autoFetchToken?.toString?.()}`)} +${indentString(`auto_refresh_token: ${auth?.oauth2?.autoRefreshToken?.toString?.()}`)} } `; @@ -242,8 +242,8 @@ ${indentString(`token_placement: ${auth?.oauth2?.tokenPlacement || ''}`)}${ }${ auth?.oauth2?.tokenPlacement !== 'header' ? '\n' + indentString(`token_query_key: ${auth?.oauth2?.tokenQueryKey || ''}`) : '' } -${indentString(`auto_fetch_token: ${(auth?.oauth2?.autoFetchToken).toString()}`)} -${indentString(`auto_refresh_token: ${(auth?.oauth2?.autoRefreshToken).toString()}`)} +${indentString(`auto_fetch_token: ${auth?.oauth2?.autoFetchToken.toString?.()}`)} +${indentString(`auto_refresh_token: ${auth?.oauth2?.autoRefreshToken.toString?.()}`)} } `; diff --git a/packages/bruno-lang/v2/tests/fixtures/request.bru b/packages/bruno-lang/v2/tests/fixtures/request.bru index ad66c64e8..7cc1aadd6 100644 --- a/packages/bruno-lang/v2/tests/fixtures/request.bru +++ b/packages/bruno-lang/v2/tests/fixtures/request.bru @@ -59,11 +59,18 @@ auth:oauth2 { callback_url: http://localhost:8080/api/auth/oauth2/authorization_code/callback authorization_url: http://localhost:8080/api/auth/oauth2/authorization_code/authorize access_token_url: http://localhost:8080/api/auth/oauth2/authorization_code/token + refresh_url: client_id: client_id_1 client_secret: client_secret_1 scope: read write state: 807061d5f0be pkce: false + credentials_placement: body + credentials_id: credentials + token_placement: header + token_header_prefix: Bearer + auto_fetch_token: true + auto_refresh_token: true } body:json { diff --git a/packages/bruno-lang/v2/tests/fixtures/request.json b/packages/bruno-lang/v2/tests/fixtures/request.json index 1cfe98809..a716425ab 100644 --- a/packages/bruno-lang/v2/tests/fixtures/request.json +++ b/packages/bruno-lang/v2/tests/fixtures/request.json @@ -74,15 +74,23 @@ "password": "secret" }, "oauth2": { - "grantType": "authorization_code", + "accessTokenUrl": "http://localhost:8080/api/auth/oauth2/authorization_code/token", + "authorizationUrl": "http://localhost:8080/api/auth/oauth2/authorization_code/authorize", + "autoFetchToken": true, + "autoRefreshToken": true, + "callbackUrl": "http://localhost:8080/api/auth/oauth2/authorization_code/callback", "clientId": "client_id_1", "clientSecret": "client_secret_1", - "authorizationUrl": "http://localhost:8080/api/auth/oauth2/authorization_code/authorize", - "callbackUrl": "http://localhost:8080/api/auth/oauth2/authorization_code/callback", - "accessTokenUrl": "http://localhost:8080/api/auth/oauth2/authorization_code/token", + "credentialsId": "credentials", + "credentialsPlacement": "body", + "grantType": "authorization_code", + "pkce": false, + "refreshUrl": "", "scope": "read write", "state": "807061d5f0be", - "pkce": false + "tokenHeaderPrefix": "Bearer", + "tokenPlacement": "header", + "tokenQueryKey": "access_token" }, "wsse": { "username": "john",