Release v5.1.1 decodeToken<T = any>(token?: string): T | Promise<T>
sysmat opened this issue · 4 comments
Description
- is this lib using semantic versioning?
- lib bump bug fix version, but it changes type, this more of a braking change
- ng 15 build fails
Regresion
- it works with 5.1.0
Environment
Please provide the following:
- "@auth0/angular-jwt": "5.1.1",
- @angular/compiler": "15.0.4";
Thanks for reporting. The SDK has always had a public API that made it look like it supported promises to retrieve the token, but it actually didnt, see #747 .
This has been fixed in #748 and released with the latest patch version. This could break people, but it's fixing incorrect behavior in the SDK so I believe this breaking change is justified in a patch given it's actualy fixing a bug.
In general our rule is to follow semantic versions. But when the SDK currently isn't doing what it's saying it does, I believe we should fix this rather than release a new major version only to ensure the SDK correctly does what it says it does.
Important to note tho is that, even though the return type of decodedToken
has changed, if tokenGetter
isn't set to return a Promise
, it should still return T
and not Promise<T>
, making this a breaking change (or well, a breaking fix) in terms of the types, but not on the functionality.
Promises have always been involved in the decodedToken
in the scenario were tokenGetter
would return a Promise, however the types never reflected that and the SDK didn't work as expected as the decodeToken
never considered the fact that the SDK allowed for tokens to be retrieved asynchronously.
ok, @frederikprijck thx for reason
Thanks again for reporting, I do believe we made a couple of mistakes with this release, apologies.
Looking into rectifying through #759, feel free to have a look.
Publish v5.1.2, which should revert some unnecessary breaking changes, but there are still scenario's that will be broken. But that should be the scenario's that were broken before 5.1.1. as well, and needed the fix in 5.1.1/5.1.2.