Hello, The gist is, I'm hoping someone can give me a tip on how to check whether the /auth/signinup...
b
Hello, The gist is, I'm hoping someone can give me a tip on how to check whether the /auth/signinup api call has completed. Here's the context: I'm using third party login, and I overrode the thirdPartySignInUpPOST api to add logic to check whether a user with the given supertokens userId exists in my app's database. If no such user exists, it creates one. I refer to this api call as /auth/signinup. I'm wondering if there is a way for me to check whether /auth/signinup has completed, because I have another call, /api/getUserData/, that I want to happen on login, to fetch user data, which as of now depends on the user data having been initialized in /auth/signinup. I tried using Session.doesSessionExist to trigger my api call, but it appears that the session comes into existence before /auth/signinup has completed, because using doesSessionExist as a trigger results in this order of calls: OPTIONS /auth/authorisationurl?thirdPartyId=google 204 GET /auth/authorisationurl?thirdPartyId=google 304 OPTIONS /auth/signinup 204 OPTIONS /api/getUserData 204 POST /api/getUserData 401 POST /auth/signinup 200 Any insight would be appreciated.
r
hey @busterbyron when the /auth/signinup API returns to the frontend, it has completed. If you override it and do some operation post calling the original implementation, that will happen before the API returns the response to the client.
The session is only created on the frontend when it receives the response from the /auth/signinup API call, and not before. If you are getting a 401 on subsequent requests, you should consider seeing this list of possible reasons: https://github.com/supertokens/supertokens-website/issues/68
2 Views