Skip to content

Commit

Permalink
Use validateToken to exchange refresh token in OAuth getFetcher (#3750)
Browse files Browse the repository at this point in the history
* Add missing "$" in template

* Use validateToken to ensure refresh token is exchanged
  • Loading branch information
garrettjstevens authored Jun 8, 2023
1 parent bce2414 commit 2df65a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export const HTTPBasicLoginForm = ({
open
maxWidth="xl"
data-testid="login-httpbasic"
title={`Log In for {internetAccountId}`}
title={`Log In for ${internetAccountId}`}
>
<form
onSubmit={event => {
Expand Down
13 changes: 2 additions & 11 deletions plugins/authentication/src/OAuthModel/model.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,18 +416,9 @@ const stateModelFactory = (configSchema: OAuthInternetAccountConfigModel) => {
const fetcher = superGetFetcher(loc)
return async (input: RequestInfo, init?: RequestInit) => {
if (loc) {
try {
await self.getPreAuthorizationInformation(loc)
} catch (e) {
console.error(e)
/* ignore error */
}
}
const response = await fetcher(input, init)
if (!response.ok) {
throw new Error(await getResponseError({ response }))
await self.validateToken(await self.getToken(loc), loc)
}
return response
return fetcher(input, init)
}
},
}
Expand Down

0 comments on commit 2df65a6

Please sign in to comment.