Skip to content

Commit c637028

Browse files
committed
Extract user id from jwt sub claim
1 parent ff34efd commit c637028

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/shopify_api/auth/jwt_payload.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ def shop
4747
end
4848
alias_method :shopify_domain, :shop
4949

50-
sig { returns(Integer) }
50+
sig { returns(T.nilable(Integer)) }
5151
def shopify_user_id
52-
@sub.to_i
52+
return unless @sub
53+
54+
@sub.tr("^0-9", "").to_i
5355
end
5456

5557
alias_method :eql?, :==

0 commit comments

Comments
 (0)