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

Inconsistent (assymetric) API (Identity.login vs Identity.hasSession) #72

Open
vasklund opened this issue Aug 29, 2018 · 0 comments
Open

Comments

@vasklund
Copy link
Contributor

vasklund commented Aug 29, 2018

I'm creating this as a bug / documentation issue, but I'm making some assumptions which might not be correct. We discovered the issue while upgrading to this library for www.svd.se.

Inconsistency

  • new Identity: redirectUri argument is optional
  • Identity.login: redirectUri argument is optional, defaults to redirectUri of constructor
  • Identity.hasSession: redirectUri argument doesn't exist, defaults to redirectUri of constructor

Example of why this is confusing

When implementing and testing Identity.login we opted to call the method with the redirectUri argument. It worked. However, when testing Identity.hasSession the auto-login feature didn't work. After debugging for a while we realized it works if we set redirectUri in the constructor instead (new Identity). But now there's no need to also call Identity.login with the redirectUri argument.

It would have been better if the documentation either told us we have to call the constructor with redirectUri (not optional) OR if Identity.hasSession also accepted a redirectUri argument (with documentation), so the API is "symmetrical" and we know it's needed for that method to work.

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

1 participant