Skip to content

Commit

Permalink
fix(refresh scheme): token.required option not taken into account (#…
Browse files Browse the repository at this point in the history
…742)

When using the refresh scheme with httponly cookies for storing the access and refresh tokens (so the tokens are not even available in the json response in this case), login fails because token.required option is not taken into account, so the scheme still expects a token. This change solves the problem when using httponly cookies.
  • Loading branch information
alibarthi authored and JoaoPedroAS51 committed Dec 18, 2020
1 parent 05a2348 commit 71f8c11
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/schemes/refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,9 @@ export class RefreshScheme<
response: HTTPResponse,
{ isRefreshing = false, updateOnRefresh = true } = {}
): void {
const token = getResponseProp(
response,
this.options.token.property
) as string
const token = this.options.token.required
? (getResponseProp(response, this.options.token.property) as string)
: true
const refreshToken = this.options.refreshToken.required
? (getResponseProp(
response,
Expand Down

0 comments on commit 71f8c11

Please sign in to comment.