-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
With WorkOS now integrating with Stripe to include entitlements in the session [1], it'd be great to have this built-in to the ruby library.
For now we're working around it by re-decoding the access token in our application to access the entitlements, something like:
# Assuming `session_data` is already defined with the sealed session data
session_instance = WorkOS::UserManagement.load_sealed_session \
client_id: credentials.client_id,
session_data:,
cookie_password: credentials.cookie_password
# Reach into `WorkOS::Session` and re-decode the JWT to get the underlying access token
unsealed_session = WorkOS::Session.unseal_data(session_instance.session_data, session_instance.cookie_password)
token = JWT.decode(unsealed_session[:access_token], nil, true, algorithms: session_instance.jwks_algorithms, jwks: session_instance.jwks).first
# We now have the underlying token, and through it the entitlements
puts token["entitlements"]This works for now, so it's not super urgent for us, it's just not very clean code :)
Metadata
Metadata
Assignees
Labels
No labels