How to migrate from firebase to pocketbase


Considering the project has been running for several months using Firebase Auth, how do we migrate?

Since they have different auth encryption algorithms, it is hard to make a smooth migration. We need users to re-input their passwords at least once, but minimize the impact on user experience. To achieve this, we need to consider different situations:

  1. New users can directly use Pocketbase auth for registration, login, and binding.
  2. Existing users, whose Firebase auth tokens are not expired, continue to use the original method to check validation until the token expires.
  3. For existing users whose Firebase auth tokens have expired, during login:
    1. If Pocketbase auth verification is successful, it indicates the user has already created a Pocketbase account, and no further handling is required.
    2. If Pocketbase auth verification fails, check the database for correspondence between the email and account:
      1. If the database contains the email and account data, directly register the user through Pocketbase auth and bind the order.
      2. If the database does not contain the email and account data, further analysis is required. It could be that the account is lost in the database, or the email has never been registered. In such cases, human intervention is necessary.