-
Notifications
You must be signed in to change notification settings - Fork 126
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
Handle error cases for embedded apps using token exchange strategy #532
Handle error cases for embedded apps using token exchange strategy #532
Conversation
e471df0
to
9a1ecf8
Compare
9a1ecf8
to
34e1752
Compare
|
||
config.sessionStorage.deleteSession(session.id); | ||
|
||
respondToInvalidSessionToken({ |
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.
Should this be throwing?
request, | ||
session, | ||
params, | ||
authStrategy, |
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.
I like the solution of having the strategy determine how we handle errors, but I'm a little on the fence about passing in the entire auth strategy as a parameter for creating the context, it feels like we're mixing concerns a little bit.
What if, instead of passing the strategy in to handleClientErrorFactory
, we have the strategy export its own flavour of handleClientErrorFactory
, something like
public async handleClientError({
request,
session,
}: StrategyHandleClientErrorOptions): Promise<HandleAdminClientError> {
const {config, api, logger} = this;
return handleClientErrorFactory({
onError: // Do token exchange things
});
}
That way, each strategy can determine how it handles the errors and they all subscribe to a common interface without the strategy having to be shared around.
IIRC handleClientErrorFactory
is pretty much tied to the strategy already anyway, so it shouldn't really affect anything else. Perhaps it makes more sense for the strategy to just export a callback for its own error handling.
Does that sound sensible?
8e7c99c
to
cd99a7a
Compare
cd99a7a
to
92968c8
Compare
1d91f9e
to
3fc0466
Compare
WHY are these changes introduced?
Fixes https://github.com/Shopify/develop-app-access/issues/135 & https://github.com/Shopify/develop-app-access/issues/136
WHAT is this pull request doing?
401
with App Bridge retry request header401
with App Bridge retry request header401
without App Bridge retry header (since part of the request may already have been processed).Type of change
Checklist
yarn changeset
to create a draft changelog entry (do NOT update theCHANGELOG.md
files manually)