Closed minuz closed 9 months ago
I think you are confused with userStore
and stateStore
. userStore
is where the user (id token, access token) is stored. stateStore
is only used transient for the authorization process, such that the library knows which data were initially sent to the authz server and now when the authz server calls back we need to know...
This issue (question) staled, closing it for now.
Hi, I believe I found an bug on the library and here's a bit of a context. My team created a wrapper around this library so we can have a consolidated way to provide authentication through our react apps. On react apps, this wrapper works fine, but I started to look into a new mobile app (react-native) and wanted to use the wrapper, but I keep getting:
So I started to dig a bit and the wrapper essentially receives an extended version of
UserManagerSettings
interface, which then is passed into theUserManager
class.On the implementation side:
AUTH_CONFIG:
So I believe the bug comes when setting the
userStore
property from theUserManager
. TheUserManager
class consumes the value provided by the config. However, internally on theUserManager
, it creates a new instance ofOidcClient
with the same config and on its constructor, creates an instance ofOidcClientSettingsStore
, again, with the same settings, except that at this stage, the property is no longer calleduserStore
and it's nowstateStore
and since its value is not manually set from theuserStore
prop, it comes asundefined
and therefore, the following logic will always fall into the default implementation:https://github.com/authts/oidc-client-ts/blob/b3337c85c1a4e412a5077e20efd2217280fc8a51/src/OidcClientSettings.ts#L275
Unless I mis-read something, I believe that's the cause for my wrapper not to work on my mobile as the
window
object does exist, but the localStorage doesn't thus throwing the error.Please let me know if you need more information about it.