We should think about adding an extension in the documentation on how to use keycloak-angular with PWA and Mobile applications. Since Keycloak have different behavior with such scenarios, it will be good to have a proper documentation for overall guidance.
@aelkz, you are right, this is something we really could move on.
In progressive web apps, are you suggesting to describe offline access?
@aelkz could you add more information about which features we need to doc for PWA? Tks!
Hi @mauriciovigolo
At the moment we are enhancing a Platform with PWA attributes, Offline access to be precise. We are using Angular 6 with keycloak-angular. So far everything is fine (Thanks you so much for keycloak-angular :D )
The problem we are having is trying to came up with an strategy for offline access. Keycloak official documentation explains offline access in this URL: https://www.keycloak.org/docs/3.2/server_admin/topics/sessions/offline.html but we do not understand how to achieve offline access using keycloak-angular.
It could really help us if you can just give us some help or advice to enable offline access using keycloak-angular
We are willing to either help with the implementation or documentation, we just need someone to point us the right way to go.
@juansmolano, thanks for sharing your thoughts and needs. The keycloak do have support for offline access, however, as far as I know, keycloak-js doesn't. So consequently, keycloak-angular doesn't have it too.
I also think this is a must feature, supporting both PWA and Ionic, so we could move forward this discussion and feature.
Have a look at this interesting post:
https://stackoverflow.com/questions/35270343/keycloak-javascript-adapter-request-offline-token
The init method doesn't accept the scope option, but the login method does.
My workaround:
SSO Session Timeout to numbers that are usual for offline tokensstandard flow (I need the refresh token)import { KeycloakService } from 'keycloak-angular';
export class OfflineKeycloakService extends KeycloakService {
async updateToken(minValidity: number = 5) {
try {
return await super.updateToken (minValidity);
} catch (err) {
// this means that there was an issue with
// the network or the server, but no logout occurred
if ((<any>this)._instance.refreshToken) {
return false;
}
// if the token got removed, it means that there
// was a 400 of the server
throw err;
}
}
}
It's a hack, it's limited, it's less secure...but maybe it helps somebody.
Are there any new Documentations about using keycloak-angular with PWA or Cordova apps, with or without offline access token?
There are no updates on documentation to use Keycloak Angular in an offline app. There is some discussion going on in #232 about offline tokens.
It would of course be great if we can get documentation for this in place so if you have any experience using Keycloak offline please do share.
Closing this in favour of #272
Most helpful comment
Hi @mauriciovigolo
At the moment we are enhancing a Platform with PWA attributes, Offline access to be precise. We are using Angular 6 with keycloak-angular. So far everything is fine (Thanks you so much for keycloak-angular :D )
The problem we are having is trying to came up with an strategy for offline access. Keycloak official documentation explains offline access in this URL: https://www.keycloak.org/docs/3.2/server_admin/topics/sessions/offline.html but we do not understand how to achieve offline access using keycloak-angular.
It could really help us if you can just give us some help or advice to enable offline access using keycloak-angular
We are willing to either help with the implementation or documentation, we just need someone to point us the right way to go.