Open Closed

How to pass __tenant as query param or header param through angular UI login button click? #1052

[email protected] created

ABP Framework version: 4.2.0 UI type: Angular Identity Server Separated: yes.

I'm capable of resolving the tenant on my UI - {0} then all the requests have a __tenant param, but when I click the login button of my Angular UI, the app is redirected to the endpoint and the __tenant param on the header isn't present anymore. My need is to pass the __tenant param to identify the tenant on the identity server.

How can this be achieved? Is it through the UI? Is there another way to identify the tenant on the identity server?

2 Answer(s)
  • 0
    Mehmet created
    Support Team


    The tenant id cannot be added to the header while redirecting to the login page. Because, in the authorization code flow, the angular-oauth2-oidc package is using below code to redirect:

    location.href = uri;

    However, you can send the tenant id as a query parameter like this:

    import { OAuthService } from 'angular-oauth2-oidc';
    import { MultiTenancyService } from '@abp/ng.core';
    export class MyComponent {
        private oAuthService: OAuthService,
        private multiTenancyService: MultiTenancyService
      ) {};
      login() {
        this.oAuthService.initCodeFlow(null, { tenant: }); // navigates to IdentityServer login page
  • 0
    [email protected] created

    Thank you Mehmet! A passed a __tenant parameter and this solved the proposed issue.