-
Notifications
You must be signed in to change notification settings - Fork 482
Make sub and sid jwt claims optional #1369
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
Make sub and sid jwt claims optional #1369
Conversation
fc02a05 to
96be21d
Compare
| sig { returns(Integer) } | ||
| def shopify_user_id | ||
| @sub.to_i | ||
| end |
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.
How can this work?
If the sub is gid://shopify/Customer/123456789, shouldn't this method return 123456789?
gid://shopify/Customer/123456789.to_i returns 0
@lizkenyon I think this is the answer to your question here: https://github.com/Shopify/shopify-api-ruby/pull/1346/files#r1831667330
96be21d to
300e713
Compare
The generated session token on the checkout ui extensions doesn't contain: - The `sid` claim - The `sub` claim if the customer is not logged in Making them mandatory causes an `Expected type String, got type NilClass` error
300e713 to
4bc8538
Compare
lizkenyon
left a comment
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.
A few comments!
One question I have is how are you (or how are you planning to) currently validating your session token in your app? ie. Are you using a controller concern from shopify_app?
Yes, I've an |
…from the admin and the sub claim is an user id
lizkenyon
left a comment
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.
Thank you for your contribution! ⭐
Description
The generated session token on the checkout ui extensions doesn't contain:
sidclaimsubclaim if the customer is not logged inHaving them mandatory causes an
Expected type String, got type NilClasserrorHow has this been tested?
After adding the patch, I've made my app use my local version of the
shopify-apigem:After that, I've tested my app and session works correctly
I've finally tested the checkout ui extension and no errors is thrown now. Also I'm now able to get the logged in customer by decoding the jwt
Checklist: