User doesnt become member of organization after invitation

Hello Auth0 team.
I want to invite a new user to my organization in my app(SPA).
I have generated the invitation link using management api and it is successfully sending the invitation link to the specified email.
But when signup using that email, that user doesnt become the member of my organization.
The invitation link contains everything that is required in doc.
e.g https://7637-107-155-105-218.ngrok-free.app/?invitation=uk6Q30SMT7rSyPXA7HxSqxdjQzPdhdy0&organization=org_ySeWEvsJsRv3rbcW&organization_name=crafter-test

I have set up the app in organization tab to enable all endusers use it by selecting Both.
And I have enabled connection in organization and membership on auth.
But the invitation status becomes pending whenever user accepts invitation and signup.
And also while creating invitation link, i have added metadata and user_metadata but they are not showing in auth0 user details.

Please help me to figure this out.
Thank you.

4 Likes

I have the same issue. Auth0 team, please answer this question.

1 Like

Same issue here please help

I was running into a similar issue…
If you followed any of the quick starts to set up your application, invites are not automatically set up for you. You’ll know this is happening if you follow an invite link (like the one in the original question) and you are greeted with a login screen. With invites working correctly, you should be greeted with an “accept invitation” screen like this one

You’ll need to edit your auth handler like so (this is for next js pages router).
Seems to be working for me so far. Invite links working and normal login still functioning the same


// src/pages/api/auth/[auth0].ts
import { handleAuth, handleLogin } from '@auth0/nextjs-auth0';

export default handleAuth({
  async login(req: any, res: any) {
    await handleLogin(req, res, {
      // forward invitation and organization params to get invites working
      authorizationParams: {
        invitation: req.query.invitation,
        organization: req.query.organization,
      },
    });
  },
});

auth0 docs (not so helpful in this case): Configure Default Login Routes
pages router setup (helpful): GitHub - auth0/nextjs-auth0: Next.js SDK for signing in with Auth0
code docs: nextjs-auth0/src/handlers/login.ts at main · auth0/nextjs-auth0 · GitHub

1 Like