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.

Question about PWA when user is offline

See original GitHub issue

Library

  • msal@1.x.x or @azure/msal@1.x.x
  • @azure/msal-browser@2.x.x
  • @azure/msal-node@1.x.x
  • @azure/msal-react@1.x.x
  • @azure/msal-angular@0.x.x
  • @azure/msal-angular@1.x.x
  • @azure/msal-angular@2.x.x
  • @azure/msal-angularjs@1.x.x

Description

Hello,

We are hoping to convert our angular application into a PWA so that we can offer some of the application up to a user that loses internet connection. The more I read about how authentication works, the more my guess is confirmed that without internet, you really can’t trust who the user is in the application.

But I’d like to ask the question: will this library let me have certain feature modules that don’t require authentication to be able to be used longer than the token expiration normally allows them to? In other words, it seems like this library automatically tries to refresh tokens behind the scenes, and I’d imagine those would fail without an internet connection. Do those token refreshes only happen when a resource is requested that is in the protected resource map? Or will the token refresh happen on its own when the token expires?

If we prevent making http calls to resources that are protected, can the user, even if their token is expired, still navigate the rest of the site as long as they don’t try to make calls to protected resources?

I’m trying to figure out if this is even going to be possible while using this library, and I’m looking through the source code. I feel like it’ll be possible, but I was hoping to get a response from one of the maintainers in regards to their opinion on how to go about this.

Source

  • Internal (Microsoft)
  • Customer request

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonnuttercommented, Mar 25, 2021

When you say that MSAL Angular v2 does not make a network request when the ID token has expired, what does it do instead?

Sorry, to be clear, MSAL Angular v1 invokes acquireTokenSilent with the client id scope in the MSAL Guard, which is how an ID token is acquired in MSAL.js v1.

The MSAL Guard for MSAL Angular v2 only looks at the cached accounts, and does not call acquireTokenSilent (and thus will not potentially make a network request).

And yes, we would recommend moving to MSAL Angular v2, especially if you are upgrading your version of Angular. We’ll have more details on GA soon.

0reactions
msftbot[bot]commented, May 16, 2021

jakehockey10 This issue has been automatically marked as stale because it is marked as requiring author feedback but has not had any activity for 5 days. If your issue has not been resolved please leave a comment to keep this open. It will be closed in 7 days if it remains stale.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PWA run offline - Stack Overflow
I read somewhere that a PWA or the service worker needs a https something to run? How can i run a PWA offline?...
Read more >
22 PWA Interview Questions Every Developer Should Know
In a context of PWA a general recommendation for storing data offline: For the network resources necessary to load your app while offline,...
Read more >
Offline and network connectivity support in Progressive Web ...
This simple introduction shows how to use caching in your progressive web app (PWA). Each PWA is different and may use different caching ......
Read more >
Making PWAs work offline with Service workers
In this article we took a simple look at how you can make your PWA work offline with service workers. Be sure to...
Read more >
14 most frequently asked questions about Progressive Web ...
They will also like the fact that PWA works (completely or partially) offline and that when he adds PWA to the home screen...
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