-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support entitlements in the Session #336
Comments
Also, as this may be useful to others, we have a service class to use the internal WorkOS API methods to be able to get and set the # Manually implemented organisation API integration
# until workos-ruby includes the stripe_customer_id attr
class WorkosStripeService
class << self
include WorkOS::Client
def fetch_workos_organization(id)
fail "Missing organization id" unless id.present?
org_response = execute_request(request: get_request(
auth: true,
path: "/organizations/#{id}",
))
JSON.parse(org_response.body, symbolize_names: true)
end
# Manually implemented until workos-ruby includes the stripe_customer_id attr
def update_workos_organisation!(id, name:, stripe_customer_id:)
update_response = execute_request(request: put_request(
auth: true,
body: {
name:,
stripe_customer_id:
},
path: "/organizations/#{id}"
))
parsed = JSON.parse(update_response.body, symbolize_names: true)
fail parsed["message"] if parsed["message"]
parsed
end
end
end Usage: # Get
workos_organization_data = WorkosStripeService.fetch_workos_organization(org_id)
puts workos_organization_data[:stripe_customer_id]
# Set
WorkosStripeService.update_workos_organisation!(org_id, name: org_name, stripe_customer_id: stripe_customer_id) |
The second comment is related to #346. |
adam-h
added a commit
to adam-h/workos-ruby
that referenced
this issue
Jan 24, 2025
If the users organisation has a stripe link the token includes any entitlements, this should be exposed to client code. Fixes workos#336
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
This works for now, so it's not super urgent for us, it's just not very clean code :)
1: https://workos.com/docs/user-management/entitlements
The text was updated successfully, but these errors were encountered: