Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v5.1.1 decodeToken<T = any>(token?: string): T | Promise<T> #757

Closed
sysmat opened this issue Dec 15, 2022 · 4 comments
Closed

Release v5.1.1 decodeToken<T = any>(token?: string): T | Promise<T> #757

sysmat opened this issue Dec 15, 2022 · 4 comments
Assignees
Labels

Comments

@sysmat
Copy link

sysmat commented Dec 15, 2022

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";
@frederikprijck
Copy link
Member

frederikprijck commented Dec 15, 2022

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.

@sysmat
Copy link
Author

sysmat commented Dec 15, 2022

ok, @frederikprijck thx for reason

@sysmat sysmat closed this as completed Dec 15, 2022
frederikprijck referenced this issue Dec 20, 2022
* Support promise based tokenGetter in JwtHelperService

* Revert doublequotes

* Fix lint issues

* Fix tests

* fix tests
@frederikprijck
Copy link
Member

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.

@frederikprijck
Copy link
Member

frederikprijck commented Dec 21, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants