Base solution for your next web application
Open Closed

Authenticate to ASPZero using Password Grant from Angular 8 #8167


User avatar
0
ibtikar created

Dear Team,

we am implementing a front end system based on Angular 8 and i want the system to use the Identity Server Integration of ASPZero, i already enabled the Identity Server Integration on the ProjectName.Web.Host and was able to login suucessfuly to the Password Grant client when i am not using the Tenant Users.

the Library that i am using for OIDC is angular-oauth2-oidc

i am using the function fetchTokenUsingPasswordFlowAndLoadUserProfile for the login process but i am not able to pass the Abp.TenantId to it

please Advice Regards


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    hi @ibtikar

    Please share the code about function fetchTokenUsingPasswordFlowAndLoadUserProfile

  • User Avatar
    0
    ibtikar created

    Kindly find the Code Below

    let headers = new HttpHeaders(); 
    headers = headers.set('Abp.TenantId', '2');
    
    this.oauthService.fetchTokenUsingPasswordFlowAndLoadUserProfile(
        "******",
        "******", 
        headers
        )
        .then(() => {
        console.debug('successfully logged in');
        this.loginFailed = false;
        })
        .catch(err => {
        //console.error('error logging in', err);
        this.loginFailed = true;
        });
        ```
    
  • User Avatar
    0
    maliming created
    Support Team

    hi @ibtikar

    Can you confirm if there is a request header of Abp.TenantId in the request.

    Have you changed the TenantIdResolveKey? Do you use a proxy web server hosting API? like nginx.

    eg:

  • User Avatar
    0
    ismcagdas created
    Support Team

    This issue is closed because it has not had recent activity for a long time.