-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#6656 Partner refresh tokens #8650
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
0e2061b
update api client architecture and add partner auth token refresh int…
8599674
add tests for refresh function
5b3cc37
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
15e05f5
naming
4d56476
another test case + cleanup
dc0b8ec
fix tests
f461ae4
fix lint
006aec0
fixes and strict null checks cleanup
c41a05b
auto add strict null checks files
2cfbf06
fix required partner auth test
3e95961
fix error message in test
3d98c2a
strict null check the test file
c374008
remove expectContext check and add tests for launchAuthIntegration. A…
c6de227
cleanup
73298ee
fix gsheets tests
d79ab2c
fix lint and strict null checks
54bacf3
add file to strict null checks
820df01
remove unused factory
f304991
fix package-lock
841f65e
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
65f3bc4
fix package-lock after merge
9f010de
remove deleted file
b60ea33
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
89b5816
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
2b90fb9
fix package lock
87fd635
revert new chrome api call because we can't test it
333ce91
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
c368fe0
fix strict null checks, fix grant_type, fix logic around client_id
184251c
fix test
6727165
fix issue with storage being cleared when it doesn't need to be cleared
7ec0db8
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
77d013b
use helper function
0f7bfbe
add test button and fix bugs
20fc5c5
fix weird storage logic and move chrome.identity function to the back…
276e999
fix tests
f1089fa
Merge branch 'main' into feature/6656-partner-refresh-tokens-take-2
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright (C) 2024 PixieBrix, Inc. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
import type { AxiosError } from "axios"; | ||
import { isObject } from "@/utils/objectUtils"; | ||
|
||
const UNAUTHORIZED_STATUS_CODES = new Set([401, 403]); | ||
|
||
export function isAuthenticationAxiosError( | ||
error: Pick<AxiosError, "response">, | ||
): boolean { | ||
// Response should be an object | ||
if (!isObject(error.response)) { | ||
return false; | ||
} | ||
|
||
// Technically 403 is an authorization error and re-authenticating as the same user won't help. However, there is | ||
// a case where the user just needs an updated JWT that contains the most up-to-date entitlements | ||
if (UNAUTHORIZED_STATUS_CODES.has(error.response.status)) { | ||
return true; | ||
} | ||
|
||
// Handle Automation Anywhere's Control Room expired JWT response. They'll return this from any endpoint instead | ||
// of a proper error code. | ||
if ( | ||
error.response.status === 400 && | ||
isObject(error.response.data) && | ||
error.response.data.message === "Access Token has expired" | ||
) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe leave a comment as to why we want this instead of
clearAllCachedAuthTokens
which we used previously