authstore null in react native #4787
-
I used this in the login component of a react native project, but when I navigate to the home screen, I don't get their authStore values.how to solve this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
The above code is not enough to understand and pinpoint the cause of the issue. How did you initialize the SDK? Did you define a new store or you are using the default one? See the example how to load an If the above doesn't help, please elaborate a little more and/or provide a more detailed code sample showing how do you initialize the SDK and how do you perform the authStore check between navigation (eg. do you call |
Beta Was this translation helpful? Give feedback.
-
I have a issue with pb.authStore.isValid in PocketBase v0.21.2 and Expo v51. I can successfully log in using pb.collection('users').authWithPassword('username', 'password'). Despite a successful login, pb.authStore.isValid consistently returns false. This is a reproducible example: https://snack.expo.dev/@b.guerrero/simple-pb-auth |
Beta Was this translation helpful? Give feedback.
You are creating 2 different PocketBase instances, and the one in your
Home
component doesn't use the store defined inhandleLogin
.Move the SDK initialization in a new js file (when using the JS SDK instance on the client-side it is safe to have a single global instance):
And then you can simply import it your compon…