working with JS…this always returns null for the current user even though the login shows valid. I was expecting a User object with details to be present…am I using this wrong?
I should clarify…i am using Google API for the login. The Google auth is successful and returns me to my first app page which needs user data. I’m trying to get the user details of the login, but it just returns null.
Do I need to manually set the current user after logging in with Google API?
The isValidLogin method checks if there is a valid user-token in the app. It does not require having a full user object. So, after logging in with the Google API, the valid user-token is being set in your app, which is why isValidLogin returns true.
Now, if you need to set the current user manually, you’ve found the correct method for this - setCurrentUser. However, if you want to keep the user logged in even after refreshing or reopening the app, you need to pass true as a second argument to the setCurrentUser method (the argument name is stayLoggedIn). Then, it will remember your user.
the documentation is not clear on what methods I ‘should’ execute to complete a full login so I’m a little confused. i also want to state that i was wrong above that the isValidLogin was returning true…it never was. Even after a successful login (i can see the userToken and userId in the url) this method STILL returns a false variable.
Do I need to manually run a function that tells the app it was successful?
After the google login page do I need to manually do Step 3 in the documentation and run this?