Skip to content
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

chore(docs): update WorkOS docs #10616

Merged
merged 3 commits into from Apr 28, 2024
Merged

chore(docs): update WorkOS docs #10616

merged 3 commits into from Apr 28, 2024

Conversation

MoritzKn
Copy link
Contributor

☕️ Reasoning

The domain used in the authorization param used in the example is deprecated and no longer supported. If it is still used, WorkOS returns the error code domain_connection_selector_not_allowed with the description:

'The domain connection selector is deprecated and may no longer be used. Use the connection or organization connection selectors instead.'

See reference: https://workos.com/docs/reference/sso/get-authorization-url/error-codes#:~:text=domain_connection_selector_not_allowed

🧢 Checklist

  • Documentation
  • Tests (does not apply)
  • Ready to be merged

🎫 Affected issues

Couldn't find any open WorkOS related issues.

The `domain` used in the authorization param used in the example is deprecated and no longer supported.
If it is still used WorkOS returns the error code `domain_connection_selector_not_allowed` with the description:

> 'The `domain` connection selector is deprecated and may no longer be used. Use the `connection` or `organization` connection selectors instead.'

See reference: https://workos.com/docs/reference/sso/get-authorization-url/error-codes#:~:text=domain_connection_selector_not_allowed
@MoritzKn MoritzKn requested a review from ndom91 as a code owner April 17, 2024 10:59
Copy link

vercel bot commented Apr 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ❌ Failed (Inspect) Apr 28, 2024 2:34pm
next-auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2024 2:34pm

@MoritzKn
Copy link
Contributor Author

The docs on the main branch (docs/pages/getting-started/providers/workos.mdx) probably need to be updated too but I do not know what your process is for this:

@ndom91
Copy link
Member

ndom91 commented Apr 17, 2024

@MoritzKn the main / v5 docs have been updated with WorkOS to point out that one needs to pass a connectionId (check out: https://authjs.dev/getting-started/providers/workos#environment-variables)

@ndom91 ndom91 changed the title Update WorkOS Provider Documentation chore(docs): update WorkOS docs Apr 17, 2024
@ndom91 ndom91 added the documentation-v4 For https://next-auth.js.org site label Apr 17, 2024
@ndom91
Copy link
Member

ndom91 commented Apr 21, 2024

@MoritzKn also why did you remove the rest of the example code?

@MoritzKn
Copy link
Contributor Author

@ndom91 Regarding your second comment:

The whole point of the example code is to create a login page that splits the domain name from the email address, and then use that "domain" so that WorkOS can tell which connection you want to use. If you simply specify the connection using the organization or connection id, this logic is not needed.

Further, while working, the example was a little bit contrived. It's a bit strange to prompt your users to enter an email address and then only use the domain part of that email. It was simply necessary to work around the shortcoming in the WorkOS API. Just specifying the organization seems like the easiest to me.
Note: In most cases, organization and connection have a 1 to 1 relation in WorkOS. It seems that in some rare cases, an organization can have multiple connections.

Regarding your first comment:
In this version, the signIn function still uses the deprecated domain param. The necessary connection param gets mentioned but (to my knowledge) used incorrectly in the provider options. At last according to TypeScript you can not use connection as provider option like it is used here. But maybe this is because I'm on v4 and this is an v5 API..?

In my opinion, the entire "notes" section in the v5 docs is confusing and should be omitted. But maybe this is because in my use case I'm using WorkOS with just one backend providers, simply as a SAMl <> OAuth bridge.
To my understanding, for this section to make sense with the current API for multi provider user, it would need to include some logic to map from the email address to the connection ID (instead of simply using the domain).
Another option would be to just show multiple login buttons that all call the signIn("workos", undefined, { connection: "con_123" }) function but with a different connection ID.
However, I think it's fine to leave it to the developers to figure out what solution makes sense to them.

Copy link
Member

@ndom91 ndom91 left a comment

Choose a reason for hiding this comment

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

Okay yeah that makes a lot of sense. I've removed that part from the current (v5) docs as well since we support the connection param directly when using the provider there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation-v4 For https://next-auth.js.org site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants