Skip to content

Commit d15aca5

Browse files
committed
refactor(sdk-auth): improve code readability
1 parent e08687f commit d15aca5

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/sdk-auth/src/auth.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,11 @@ export default class SdkAuth {
122122
toAppend: Object
123123
): AuthRequest {
124124
const previousDecodedRequestBody = request.body ? decode(request.body) : {}
125-
const nextEncdedRequestBody = encode({
125+
const nextEncodedRequestBody = encode({
126126
...previousDecodedRequestBody,
127127
...toAppend,
128128
})
129-
request.body = nextEncdedRequestBody
129+
request.body = nextEncodedRequestBody
130130

131131
return request
132132
}
@@ -290,24 +290,24 @@ export default class SdkAuth {
290290

291291
refreshTokenFlow(token: string, config: CustomAuthOptions = {}) {
292292
if (!token) throw new Error('Missing required token value')
293-
const _config = this._getRequestConfig(config)
294293

295-
let request = SdkAuth._buildRequest(
296-
_config,
297-
this.BASE_AUTH_FLOW_URI,
298-
'refresh_token'
294+
const _config = this._getRequestConfig(config)
295+
const request = SdkAuth._appendToRequestBody(
296+
SdkAuth._buildRequest(_config, this.BASE_AUTH_FLOW_URI, 'refresh_token'),
297+
{ refresh_token: token }
299298
)
300-
request = SdkAuth._appendToRequestBody(request, { refresh_token: token })
301299

302300
return this._process(request)
303301
}
304302

305303
introspectToken(token: string, config: CustomAuthOptions = {}) {
306-
const _config = this._getRequestConfig(config)
307304
if (!token) throw new Error('Missing required token value')
308305

309-
let request = SdkAuth._buildRequest(_config, this.INTROSPECT_URI)
310-
request = SdkAuth._appendToRequestBody(request, { token })
306+
const _config = this._getRequestConfig(config)
307+
const request = SdkAuth._appendToRequestBody(
308+
SdkAuth._buildRequest(_config, this.INTROSPECT_URI),
309+
{ token }
310+
)
311311

312312
return this._process(request)
313313
}

0 commit comments

Comments
 (0)