Open Closed

While using angular-oauth2-oidc package in angular app. Whenever I try to login, It appears to be removing the access_token and id_token from localStorage. #8371


User avatar
0
Sergei.Gorlovetsky created
  • ABP Framework version: v8.3.2
  • UI Type: Angular
  • Database System: EF Core (PostgreSQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace: While using angular-oauth2-oidc package in angular app. Whenever I try to login, It appears to be removing the access_token and id_token from localStorage.
  • Steps to reproduce the issue: 1- Use IdentityServer for authentication. 2- Use angular-oauth2-oidc package in angular app. 3- Inject OAuthService in home.component.ts 4 - Try to debug the this.oAuthService.hasValidAccessToken() method, access_token and id_token firstly stored then somehow removed from localStorage.
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

3 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    could you share a test project? I will check it.shiwei.liang@volosoft.com

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    You can try

    ClientelePortalHttpApiHostModule

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        .....
        MapClaims();
    }
    private void MapClaims()
    {
        AbpClaimTypes.UserName = ClaimTypes.Name;
        AbpClaimTypes.Name = ClaimTypes.GivenName;
        AbpClaimTypes.SurName = ClaimTypes.Surname;
        AbpClaimTypes.UserId = ClaimTypes.NameIdentifier;
        AbpClaimTypes.Role = ClaimTypes.Role;
        AbpClaimTypes.Email = ClaimTypes.Email;
    }
    

    Update oAuthConfig

    const oAuthConfig = {
      issuer: identityServerUrl,
      redirectUri: baseUrl,
      clientId: 'ClientelePortal_App',
      skipIssuerCheck: true,
      responseType: 'code',
      scope: 'offline_access ClientelePortal'
    }; 
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    Sergei.Gorlovetsky created

    Hi Liangshiwei, Thank you for the suggestion. We've applied it and it worked. Have a great weekend :)

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.