Skip to content

Commit 2c02eb4

Browse files
v2.0.1 - handle InvalidJwtError with 401 instead of 500
1 parent 56c3642 commit 2c02eb4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "simple-koa-shopify-auth",
3-
"version": "2.0.0",
3+
"version": "2.0.1",
44
"description": "A better, simplified version of the (no longer supported) @Shopify/koa-shopify-auth middleware library. It removes the use of cookies for sessions (which greatly smooths the auth process), replaces a deprecated API call, and supports v2 of the official @shopify/shopify-api package.",
55
"author": "TheSecurityDev",
66
"license": "MIT",

src/create-shopify-auth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,15 @@ export default function createShopifyAuth(options: OAuthBeginConfig) {
9090
switch (true) {
9191
case err instanceof Shopify.Errors.InvalidOAuthError:
9292
ctx.throw(400, err.message);
93-
break;
9493
case err instanceof Shopify.Errors.CookieNotFound:
9594
case err instanceof Shopify.Errors.SessionNotFound:
9695
// This is likely because the OAuth session cookie expired before the merchant approved the request
9796
ctx.redirect(`${oAuthStartPath}?shop=${shop}`);
9897
break;
98+
case err instanceof Shopify.Errors.InvalidJwtError:
99+
ctx.throw(401, err.message);
99100
default:
100101
ctx.throw(500, err.message);
101-
break;
102102
}
103103
}
104104
return;

0 commit comments

Comments
 (0)