Hi All,
More precisely, I'm trying to achieve SSO with just access & refresh
tokens. But realised we need cookies too, is there a way to achieve that by
passing access token as
cookies redirection requests.
Thanks
Kapil
On Tue, Jan 29, 2019 at 5:18 PM kapil joshi <kapilkumarjoshi001(a)gmail.com>
wrote:
Hi All,
In our product, we are using keycloak.js adapter. We are receiving access
and refresh token from 3rd party server. We store these tokens in our
instance variables and update keycloak.js variables explicitly as shown
below:
let tokenStr = this.someService.tokenString;
console.log('token is ' + tokenStr);
let keycloakInstance = this.keycloakAngular.getKeycloakInstance();
if (tokenStr) {
if (keycloakInstance['tokenTimeoutHandle']) {
clearTimeout(keycloakInstance['tokenTimeoutHandle']);
keycloakInstance['tokenTimeoutHandle'] = null;
}
keycloakInstance.token = tokenStr;
keycloakInstance.authenticated = true;
this.authenticated = true;
keycloakInstance.tokenParsed = this.decodeToken(tokenStr);
keycloakInstance.subject = keycloakInstance.tokenParsed.sub;
keycloakInstance.realmAccess = keycloakInstance.tokenParsed.realm_access;
keycloakInstance.resourceAccess = keycloakInstance.tokenParsed.resource_access;
this.roles = await this.keycloakAngular.getUserRoles(true);
This code is actually taken from setToken() API of keycloak.js and we have just replaced
it in our custom code.
So that we can make use of the keycloak.js adapter variables and methods.
Problem is when we try to access the account-management UI, it takes the user to login
screen, which want to avoid.
we are not able to find out the reason behind this ? When we login to the application
and
then when we try accessing account management url then it renders the account management
page seamlessly.
Would be great if there is a solution to render account management UI when we update the
tokens programatically into keycloak.js adapter variables.
Let me know If we are doing anything wrong or work arounds to fix this issue.
Thanks
Kapil