diff --git a/package.json b/package.json index 4acbd24..c6c16e1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-oauth2-pkce", - "version": "2.0.7", + "version": "2.0.8", "description": "Authenticate against generic OAuth2 using PKCE", "author": "Gardner Bickford ", "license": "MIT", diff --git a/src/AuthService.ts b/src/AuthService.ts index d4d1d8c..bc8f83f 100644 --- a/src/AuthService.ts +++ b/src/AuthService.ts @@ -236,6 +236,10 @@ export class AuthService { method: 'POST', body: toUrlEncoded(payload) }) + if (isRefresh && !response.ok) { + await this.logout() + await this.login() + } this.removeItem('pkce') let json = await response.json() if (isRefresh && !json.refresh_token) {