Next.js and Linking Account

My app is obviously a “Regular Web App” utilizing the power of Next.js. When a user logs in, they have a button to login and we get the access_token from a call to oauth/token with grant_type: "client_credentials" and all that good stuff. We get a token, great.

But where I’m stumping is… what call should we be making on the Link Account button on the Next.js app with the access token from the Management API? Is there an endpoint I can hit where a user can login to their account to link it?

What way would be recommended for Next.js? Management API or Server-side? I ask because the example in Server-side Link Account looks outdated so just wondering what is the recommended best practices today for Next.js app.

Secondly, in conjunction with Next.js, what’s the best way to get the SECONDARY_ACCOUNT_ID_TOKEN of the user account so I can initiate a linking of accounts?

1 Like

I could use help with this too.

I need some assistance on this too. With our current implementation using the Nextjs SDK, the user’s appSession is completely overridden by the linked identity before even calling the mapi.