question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Core Library

MSAL.js v2 (@azure/msal-browser)

Core Library Version

2.16.1

Wrapper Library

MSAL Angular (@azure/msal-angular)

Wrapper Library Version

2.0.2

Description

Hi.

I’m currently building an (Angular) PWA app which uses Azure B2C as IDP. I have issues where the user is offline, and MSAL calls B2C endpoints which results in the user being redirected to B2C. Having no net, this breaks the PWA experience, and I’m not sure what happens (if the token expires or if there’s some other mechanism leading to the redirect. It’s kinda hard and time consuming to debug).

I was wondering if anyone here has experience using B2C with a PWA and would share config / insights on how to handle caching (if at all), overrides or interceptors (if required)?

I saw that you @jakehockey10 had some similar ideas and questions in #3283. Did you manage to implement this?

MSAL Configuration

MsalModule.forRoot(new PublicClientApplication({
      auth: {
        clientId: environment.auth.clientId,
        authority: environment.auth.authority,
        redirectUri: environment.auth.redirectUri,
        postLogoutRedirectUri: environment.auth.postLogoutRedirectUri,
        knownAuthorities: environment.auth.knownAuthorities
      },
      cache: {
        cacheLocation: BrowserCacheLocation.LocalStorage
      },
      system: {
        loggerOptions: {
          loggerCallback: (logLevel: LogLevel, a: string, b: boolean) => {},
          piiLoggingEnabled: false
        }
      }
    }), {
      interactionType: InteractionType.Redirect,
      authRequest: {
        scopes: [...environment.auth.scopes]
      }
    }, {
      interactionType: InteractionType.Redirect,
      protectedResourceMap: new Map([
        [environment.auth.scopesUri,
          environment.auth.scopes
        ]
      ])
    })

Relevant Code Snippets

No response

Identity Provider

Azure B2C Basic Policy

Source

External (Customer)

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:21 (18 by maintainers)

github_iconTop GitHub Comments

3reactions
bmahallcommented, Jun 27, 2022

@andreaslarssen I am currently looking into this , thanks for your patience!

1reaction
bmahallcommented, Aug 16, 2022

@andreaslarssen This is being tracked internally, dont have an ETA at this point. #3758 covers similar ask.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started with service workers
To set up the Angular service worker in your project, use the CLI command ng add @angular/pwa . It takes care of configuring...
Read more >
angular/pwa
Enables service worker builds in the Angular CLI. Imports and registers the service worker in the app module. Adds a web app manifest....
Read more >
Angular PWA, install and configure | by Pankaj Parkar
Angular PWA, install and configure. PWA stands for Progressive Web Apps. Most web sites could benefit from using PWA.
Read more >
Make Progressive Web Apps (PWA) in Angular
The two main requirements of a PWA are a Service Worker and a Web Manifest. While it's possible to add both of these...
Read more >
This is how to convert your Angular app into a PWA (2022)
The @angular/pwa package is an Angular schematics that adds Progressive Web App support to an Angular app. In a nutshell, here's a few...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found