Skip to content

Add screen_hint to Ruby Gem + vcr 6 #389

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

Merged
merged 2 commits into from
Jul 30, 2025
Merged

Conversation

Teyler7
Copy link
Contributor

@Teyler7 Teyler7 commented Jul 30, 2025

Description

As a solution to build "Sign-Up" paths in Rails applications, this adds the screen_hint to the UserManagement.authorization_url flow. This appears to be a valid api in NodeJS already (https://workos.com/docs/reference/authkit/authentication/get-authorization-url), this simply adds it to the Ruby Gem.

Unit tests have been added as well. VCR was also updated to latest in 5277fbf to resolve a global hook failure caused with vcr 5 and webmock.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[x] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

Teyler7 added 2 commits July 30, 2025 12:14
As a solution to build "Sign-Up" paths in Rails applications, this adds
the `screen_hint` to the UserManagement.authorization_url flow. This
appears to be a valid api in NodeJS already (https://workos.com/docs/reference/authkit/authentication/get-authorization-url),
this simply adds it to the Ruby Gem.

Unit tests have been added as well.
From research, this is a pretty well known issue in vcr 5 that has been
resolved in vcr 6. Running bundle exec rspec still passes with this
update.

Resolves .rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/vcr-5.0.0/lib/vcr/library_hooks/webmock.rb:36:in
`block in global_hook_disabled_requests': wrong number of arguments
(given 1, expected 0) (ArgumentError).
@Teyler7 Teyler7 changed the title Add screen_hint to Ruby Gem Add screen_hint to Ruby Gem + vcr 6 Jul 30, 2025
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR adds support for the screen_hint parameter to the UserManagement authorization URL functionality in the Ruby gem, bringing feature parity with the WorkOS Node.js SDK. The change enables developers to specify which AuthKit screen (e.g., 'sign_up' vs 'sign_in') users should land on upon redirection, facilitating the creation of dedicated sign-up flows in Rails applications.

The implementation follows established patterns in the codebase by:

  • Adding the optional screen_hint parameter to the authorization_url method signature with a default value of nil
  • Including proper documentation that specifies the parameter only applies when the provider is 'authkit'
  • Passing the parameter through to the query string construction alongside existing optional parameters like login_hint and domain_hint
  • Maintaining backward compatibility since the parameter is optional

The PR also includes a VCR dependency update from version ~> 5.0.0 to ~> 6.0 to resolve compatibility issues with webmock that were causing global hook failures in the test suite. Comprehensive test coverage has been added to verify URL generation, hostname handling, and proper query string formatting for the new parameter.

Confidence score: 5/5

  • This PR is very safe to merge with minimal risk of production issues.
  • The implementation follows existing patterns, maintains backward compatibility, adds proper tests, and addresses a legitimate feature gap.
  • All files appear well-structured with appropriate error handling and documentation.

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

@Teyler7
Copy link
Contributor Author

Teyler7 commented Jul 30, 2025

Ideally, this would be updated in the Ruby Gem docs upon approval. I could be wrong, but I discovered this seems to be available in the API via the NodeJS docs.

https://workos.com/docs/reference/sso/get-authorization-url
Screenshot 2025-07-30 at 12 38 43 PM

Copy link
Member

@nholden nholden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@nholden nholden merged commit c749079 into workos:main Jul 30, 2025
2 checks passed
@nholden nholden mentioned this pull request Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants