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

decodeClaims uses decodeStrict' #35

Open
Lucsanszky opened this issue Dec 6, 2021 · 1 comment
Open

decodeClaims uses decodeStrict' #35

Lucsanszky opened this issue Dec 6, 2021 · 1 comment

Comments

@Lucsanszky
Copy link

I was using the library at work and since decodeClaims is using decodeStrict' from the aeson library, no meaningful error message is returned if parsing fails. I think it would be better to use eitherDecodeStrict' in order to have more information if parsing fails. Is there a good reason why eitherDecodeStrict' was not used in the first place? If not and you think it would be beneficial to use eitherDecodeStrict', then I would be happy to have a go at making those changes and modifying BadClaims to have an additional parameter which would carry the error message returned from eitherDecodeStrict'.

@tekul
Copy link
Owner

tekul commented Dec 26, 2021

I'm not sure if there was a particular reason, other than that in most cases, a server is only interested in whether a client sent the correct data in the token or not (and would not return an internal parsing error to the client). It could certainly be more useful to have that information logged though to potentially help debugging why the data is invalid.

I guess we could add an eitherDecodeClaims function mirroring the Aeson functions. That would avoid breaking existing code. Alternatively we could make the change and bump the version number. I believe there are issues with Aeson 2 which will probably require a version change anyway.

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

No branches or pull requests

2 participants