Sign in¶
Now let's implement a sign in page.
The sign in code and functionality is very similar to the sign up functionality. In short, when a user signs in
- The
signInWithEmailAndPassword()
function is invoked.
- A pair of
POST
requests are made to identitytoolkit.googleapis.com
.
- The first
POST
request hits the accounts:signInWithPassword
endpoint. If the response is good (200), it returns the user's idToken
as a JWT.
- The second
POST
request hits the accounts:lookup
endpoint.
router.push("/")
redirects the user to the home page.
Sign out¶
Now let's implement the Sign out button.
Let's see it in action, paying close attention to the IndexedDB.
Notice the sign out mechanism deletes the user data from the IndexedDB.