Angular organization login missing organization_id in JWT

I have an Angular application that we have been using with auth0 for a while. We are working on integrating organization support into the code base.

In our app we have a component that is use to manage regular vs organizational login and invitations. when someone goes to a URL that is formatted like so.


It does direct me to the login for that organization. However, when the user is logged in their JWT token does not contain organization_id segment, and therefore we don’t know they are login as a member of an organization.

Am I missing something here?

import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { AuthService } from '@auth0/auth0-angular';

  selector: 'app-login',
  template: '',
  styleUrls: []
export class LoginComponent implements OnInit {

    private auth: AuthService,
    private activatedRoute: ActivatedRoute
  ) { }

  ngOnInit(): void {
    const queryParams = this.activatedRoute.snapshot.queryParams;
    const params = this.activatedRoute.snapshot.params;
    const queryParamsKeys = Object.keys(queryParams);
    const paramsKeys = Object.keys(params);

    if (queryParamsKeys.includes('invitation') && queryParamsKeys.includes('organization')) {
      this.organizationLoginWithInvitation(queryParams.organization, queryParams.invitation);
    else if (queryParamsKeys.includes('organization')) {
    else if (paramsKeys.includes('organization')) {
      // Check for organization name with the API and if it exists get the organization ID from it.
      // and redirect to the correct login page.
    else {
        redirect_uri: window.location.origin + '/auth/callback',

  private organizationLoginWithRedirect(organization: string): void {
    const payload = {
        organization: organization,
        redirect_uri: window.location.origin + '/auth/callback',

  private organizationLoginWithInvitation(organization: string, invitation: string): void {
      organization: organization,
      invitation: invitation,
      redirect_uri: window.location.origin + '/auth/callback',


Hey there @openbridge-james!

Very curious the organization_id isn’t present in the resulting tokens, it should be. Can you confirm the org_id is indeed being included in the authorize call by inspecting the network requests?

Let us know!

I found the problem, it was not auth0 related, but the way we implemented some retry/redirect code that recalled loginonredirect without the organization.

Ah ok good to know you were able to get this sorted! Thanks for following up here :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.