File tree Expand file tree Collapse file tree 1 file changed +45
-1
lines changed Expand file tree Collapse file tree 1 file changed +45
-1
lines changed Original file line number Diff line number Diff line change 1- # parse -server-firebase-auth-adapter
1+ # Parse -server-firebase-auth-adapter
22Authenticate to parse server with your Firebase account
3+
4+ ## How to use it?
5+ ### 1) Install the module
6+ ``` js
7+ npm i - S parse- server- firebase- auth- adapter
8+ ```
9+ ### 2) Add environment variables
10+ * Copy the ` firebaseAccountKey.json ` from Firebase into your folder, maybe root of your project's folder.
11+ * Add new environment into your ` .env ` or using export in your terminal.
12+ ``` js
13+ // firebaseAccountKey.json store in root of project.
14+ FIREBASE_SERVICE_ACCOUNT_KEY = ' ../../firebaseAccountKey.json'
15+
16+ // URL for connect to Firebase database.
17+ FIREBASE_DATABASE_URL = " https://SOME_ID.firebaseio.com"
18+ ```
19+ ### 3) Add this module when creating ` ParseServer `
20+ ``` js
21+ import { ParseServer } from ' parse-server'
22+ import firebaseAuthAdapter from ' parse-server-firebase-auth-adapter'
23+ ...
24+ const parserServer = new ParseServer ({
25+ ...
26+ auth: {
27+ firebase: firebaseAuthAdapter
28+ }
29+ })
30+ ```
31+ ### 4) Using Firebase access token in our project
32+ * Get Parse access token by POST a raw data to ` /parse/users `
33+ ``` sh
34+ curl -X POST \
35+ {{host}}/parse/users \
36+ -H ' content-type: application/json' \
37+ -H ' x-parse-application-id: {{ParseAppId}}' \
38+ -d ' {
39+ "authData": {
40+ "firebase": {
41+ "access_token": "{{access_token}}",
42+ "id": "{{FirebaseUID}}"
43+ }
44+ }
45+ }'
46+ ```
You can’t perform that action at this time.
0 commit comments