workos / workos-node

Official Node SDK for interacting with the WorkOS API
https://workos.com/docs/sdk/node
MIT License
120 stars 29 forks source link

Support theme while redirecting user to authorization URL #1129

Open sagar7993 opened 2 months ago

sagar7993 commented 2 months ago

Can we allow support for rendering theme while creating the authorization URL? Right now I have to manually set it as light/dark in the WorkOS dashboard. But I would love to have the capability to set the theme while constructing the authorization URL. Here's what I am proposing

const authorizationUrl = workos.userManagement.getAuthorizationUrl({
    provider: 'authkit',
    screenHint: 'sign-in',
    redirectUri: `<REDIRECT_URL>`,
    clientId: <WORKOS_CLIENT_ID>,
    state: redirectUrl,
    // Add new option called `theme`
    theme: 'dark' // Possible values are `light` or `dark` or `system` or `undefined`
});
redirect(authorizationUrl);

This will allow me to keep my login page in sync with the user's theme choice on my own dashboard. If user has selected dark mode on my dashboard, I would like to be able to send them to a dark themed login page.

PaulAsjes commented 2 months ago

Hi @sagar7993! Thanks for the feedback, seems like a useful feature. I've let the team know and I'll update this issue once I have more info.

sagar7993 commented 1 month ago

@PaulAsjes thanks for your prompt response, much appreciated. 👏🏼 Do let me know whenever this feature is launched. Thanks in advance.