I have an M2M application, and I want to ensure that every time a company requests a demo of my app, an organization is automatically created, and an invitation is sent to the user who requested the demo to join the newly created organization as an administrator. However, I have a question about how to handle the invitation process. Currently, the invitation is sent as a link like this:
https://www.myapp.com/activate?invitation=TOKEN=org_xyz&organization_name=example
I would like to know what logic I should implement or what flow I should follow so that when the user accepts the invitation and signs up using Google or another provider, they are automatically redirected to the home page of my Next.js application.
I would appreciate any help or guidance you can provide.