stytchauth / stytch-node

Official Stytch Backend SDK for Node.js
https://stytch.com
MIT License
90 stars 21 forks source link

TS String Enum for Stytch Token Type #323

Open grant opened 4 months ago

grant commented 4 months ago

I'd like to have a TS constant and a union type. Something like:

import {StytchToken, StytchTokenType} from "stytch";

const MAGIC_LINKS_TOKEN: StytchTokenType = StytchToken.Magic_Links; // "magic_links";

Docs:

https://stytch.com/docs/guides/dashboard/redirect-urls#structure

I don't want to use the "magic_links" string.

chris-stytch commented 3 months ago

Heya @grant! Thanks for the feedback.

You can see how we handled this in one of our Next.js example apps here: https://github.com/stytchauth/stytch-nextjs-integration/blob/main/pages/authenticate.tsx#L5-L24

Our app using consts there does align with the theme of your feedback here as well. I'll chat with our SDK team about this!

grant commented 3 months ago

Sweet, sounds good @chris-stytch . Will hardcode these for now.