B2B NextJS Example Discrepancy

I was following the B2B NextJS example app from yalls Github, and I brought over some code for OAuth discovery start url building and I noticed a discrepancy between the generated URLs from the Github repo and my custom repo.

Generated URLs:

Stytch Github: https://test.stytch.com/v1/b2b/public/oauth/google/discovery/start?public_token=<token>&discovery_redirect_url=http://localhost:3000/api/callback
My Personal Project: https://test.stytch.com/b2b/public/oauth/google/discovery/start?public_token=<token>&discovery_redirect_url=http://localhost:3000/api/callback

With my personal project, I was getting 404 route_not_defined errors from the generated link. The difference I found was that my personal project’s generated url wasn’t including the v1 in front of the b2b path.

I believe I tracked down the discrepancy from the Stytch clients being different:

Stytch Github: "stytch": "^7.5.1",
My Custom Project "stytch": "^8.4.2",

Where the stytchEnv for 7.5.1 is formatted like

export declare const test = "https://test.stytch.com/v1/";
export declare const live = "https://api.stytch.com/v1/";

and the stytchEnv for 8.4.2 is formatted like

export declare const test = "https://test.stytch.com/";
export declare const live = "https://api.stytch.com/";

I fixed this for my local project by simply prepending a v1 to my url generation step. But wanted to make sure this was expected or not.

Hi Kaelen,

Thanks for reaching out and mentioning this!

You’re right that this change in Test and Live URLs took place from v7 to v8 of our JavaScript SDK. Your action to workaround it is the intended way to resolve this.

I’ve opened a PR to make sure we update that example app to version 8 of our SDK and update the URL patterns there as well for a more up-to-date example.

Best,
Christopher
Stytch Developer Success