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.
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 optionalIdentity.login
:redirectUri
argument is optional, defaults toredirectUri
of constructorIdentity.hasSession
:redirectUri
argument doesn't exist, defaults toredirectUri
of constructorExample of why this is confusing
When implementing and testing
Identity.login
we opted to call the method with theredirectUri
argument. It worked. However, when testingIdentity.hasSession
the auto-login feature didn't work. After debugging for a while we realized it works if we setredirectUri
in the constructor instead (new Identity
). But now there's no need to also callIdentity.login
with theredirectUri
argument.It would have been better if the documentation either told us we have to call the constructor with
redirectUri
(not optional) OR ifIdentity.hasSession
also accepted aredirectUri
argument (with documentation), so the API is "symmetrical" and we know it's needed for that method to work.