angular-auth-oidc-client icon indicating copy to clipboard operation
angular-auth-oidc-client copied to clipboard

TokenHelperService not available via Public API anymore in v14

Open meisterlampe opened this issue 3 years ago • 5 comments

Hi there,

I just tested Version 14 of this great library and wasn't able to import the TokenHelperService from angular-auth-oidc-client anymore. It has been removed with this commit: https://github.com/damienbod/angular-auth-oidc-client/commit/e7699f7a0c07128dd8f94dd2c5e1445f66c8863b

I know I can implement the functionality by myself, but I just wanted to ask kindly, if this change was intended. I liked having this helper right away :)

Thanks a lot and best wishes

meisterlampe avatar May 20 '22 10:05 meisterlampe

Hey, what did you use from the helper? This was an internal helper, and normally you would not need the methods. So what did you exactly use?

FabianGosebrink avatar Jul 18 '22 06:07 FabianGosebrink

I'm just using the service as an easy and built-in way to get the payload of the token (for getting the user-roles). It's ok for me to create my own Helper-Service as it is not that complex. I think, I will do that or is there maybe another preferred way to access the token-payload?

meisterlampe avatar Jul 18 '22 09:07 meisterlampe

The sense behind this is that we provide every method used through a public facade, or at least as much as we can. So which method explicitly do you need? Thanks!

FabianGosebrink avatar Jul 20 '22 08:07 FabianGosebrink

I'm using https://github.com/damienbod/angular-auth-oidc-client/blob/9cd967a647a32629d5fb1212947917b61b10ac1c/projects/angular-auth-oidc-client/src/lib/utils/tokenHelper/token-helper.service.ts#L42

meisterlampe avatar Jul 20 '22 16:07 meisterlampe

Also a problem for myself, was using the same function.

donnyst avatar Jul 21 '22 12:07 donnyst

You can use the "getPayloadFromIdToken" method, which is exposed. Docs: getPayloadFromIdToken(encode = false, configId?: string)

FabianGosebrink avatar Aug 06 '22 13:08 FabianGosebrink

This is about getting the payload from the access token, not the ID token. getPayloadFromIdToken does not suffice.

donnyst avatar Aug 08 '22 11:08 donnyst

I even tried the getuserData method & the userdata$ observable, Both are returning the data from the IdToken only not the access token.

arokkiadurairaj avatar Sep 21 '22 14:09 arokkiadurairaj

PR is merged, will be in the next release.

FabianGosebrink avatar Sep 22 '22 05:09 FabianGosebrink

this is released in 14.1.5

damienbod avatar Sep 22 '22 11:09 damienbod