User Sign-up, Login, and Authentication via Firebase API
Thunkable AI can generate apps with full user authentication using the Firebase Authentication REST API. This includes sign-up, login, and session handling out of the box.
Last updated
I want to use Firebase Auth API to handle account creation and login.
This is the sample code from their API: curl 'https://identitytoolkit.googleapis.com/v1/accounts:signUp?key=[API_KEY]' \ -H 'Content-Type: application/json' \ --data-binary '{"email":"[[email protected]]","password":"[PASSWORD]","returnSecureToken":true}'Use Firebase's Auth API to handle user login
This is the sample code from their API: curl 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key=[API_KEY]'
-H 'Content-Type: application/json'
--data-binary '{"email":"[[email protected]]","password":"[PASSWORD]","returnSecureToken":true}'Add a "forget password" that makes an api call.
Here is the sample code: curl 'https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]' \ -H 'Content-Type: application/json' \ --data-binary '{"requestType":"PASSWORD_RESET","email":"[[email protected]]"}'When users create an account, send an email verification through an api call.
The sample code is this: curl 'https://identitytoolkit.googleapis.com/v1/accounts:sendOobCode?key=[API_KEY]' \ -H 'Content-Type: application/json' \ --data-binary '{"requestType":"VERIFY_EMAIL","idToken":"[FIREBASE_ID_TOKEN]"}'When trying to login, check to make sure that the email is verified before letting them login.
Sample code here: curl 'https://identitytoolkit.googleapis.com/v1/accounts:update?key=[API_KEY]' \ -H 'Content-Type: application/json' --data-binary '{"oobCode":"[VERIFICATION_CODE]"}'