Firebase Auth JS/PHP

后端 未结 3 2034
温柔的废话
温柔的废话 2020-12-30 16:21

I\'ve been tasked to build a web interface for an Android app based on firebase. I\'ve got a handful of endpoints, that interact with the database (Cloud functions). To acce

3条回答
  •  余生分开走
    2020-12-30 17:12

    You really aren't supposed to use sessions in PHP when using tokens. Tokens should be sent in the header on every request (or a cookie works too).

    Tokens work like this: 1. You sign in, the server mints a token with some information encoded 2. You send that token back on every request

    Based on the information encoded in the token, the server can get information about the user. Typically a User ID of some sort is encoded in it. The server knows it's a valid token because of the way it's encoded.

    Send the token on every request you need to make, then in PHP you can just pass that token to the other API

提交回复
热议问题