0
votes

I'm creating a game in which I would like to use firebase authentication using cloud functions for logging in and registering users. Since my dev platform (GameMaker Studio 2) doesn't have the firebase sdk, I've resulted in attempting to use the firebase auth restAPI. To authenticate a user, I have to at one point create a custom token using the users uID and then use that to login. The problem with this is that I can't really understand the flow of the authentication. How could the client have knowledge beforehand on it's userID from parameters such as email and password?

Any help in understanding the flow I need to authenticate a user will be greatly appreciated.

1
When you make a post request to the Firebase Rest API with your credentials, it returns a response with Uid, here is all the info you need firebase.google.com/docs/reference/rest/auth hope it could help. - vitomadio
I seem to be getting an error code 8 when attempting to just post a html request to the verifyPassword endpoint - Sammi3
Could you share some code, to see more clearly what are you doing? - vitomadio

1 Answers

0
votes

If you're developing on node.JS, you should be able to use npm to install the firebase package -- that would simplify things greatly.

Otherwise, the overall flow of authentication should look as follows.

  1. Client gives email and password
  2. Pass email & password to Firebase Authentication using your HTTP request. You should receive an auth token, and a uID if authentication was successful. (see here)
  3. Now you have an id token that you can set as a cookie in your client's browser. You can verify this cookie by storing it in your backend for each subsequent GET request to your Node server.