Open Closed

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

User avatar
0 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)
  • User Avatar
    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
  • User Avatar
    0 created

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

Made with ❤️ on ABP v8.0.0 Updated on September 27, 2023, 12:25