{"id":15435202,"url":"https://github.com/drptbl/wordpress-firebase-auth-bridge","last_synced_at":"2025-04-19T18:11:19.861Z","repository":{"id":57399101,"uuid":"123425091","full_name":"drptbl/wordpress-firebase-auth-bridge","owner":"drptbl","description":"API endpoint allowing users to authenticate in Firebase using Wordpress details.","archived":false,"fork":false,"pushed_at":"2018-03-01T15:48:49.000Z","size":11,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-13T13:56:01.536Z","etag":null,"topics":["api","authentication","bridge","endpoint","firebase","wordpress"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/drptbl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-01T11:18:32.000Z","updated_at":"2022-12-06T07:34:18.000Z","dependencies_parsed_at":"2022-09-07T20:11:25.020Z","dependency_job_id":null,"html_url":"https://github.com/drptbl/wordpress-firebase-auth-bridge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Fwordpress-firebase-auth-bridge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Fwordpress-firebase-auth-bridge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Fwordpress-firebase-auth-bridge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/drptbl%2Fwordpress-firebase-auth-bridge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/drptbl","download_url":"https://codeload.github.com/drptbl/wordpress-firebase-auth-bridge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249691353,"owners_count":21311336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","authentication","bridge","endpoint","firebase","wordpress"],"created_at":"2024-10-01T18:43:05.201Z","updated_at":"2025-04-19T18:11:19.843Z","avatar_url":"https://github.com/drptbl.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wordpress-firebase-auth-bridge\nThis is an API endpoint which is used by [BRCS - Bot Remote Control System](https://github.com/drptbl/remotecontrol-app).\u003cbr\u003e\nIt allows to authenticate users in `Firebase` with `Wordpress` details (using `jwt`).\u003cbr\u003e\nIf user doesn't exist in `Firebase` it will be created first and then authenticated.\n\nIt works one-way-only so it creates and authenticates users from `Wordpress` in `Firebase` (doesn't work vice-versa yet).\n\nIn general what I wanted to achieve and what I actually achieved using this:\n- I've made a `Wordpress Woocommerce` online shop and wanted users from mobile app to have exactly the same authentication database as users from online shop\n- Users using online shop were authenticated by `Wordpress` database, but users using mobile app were authenticated by `Wordpress` first, then \"copied\" over to `Firebase` auth and then logged in to mobile app using `Firebase` SDK\n\nYou are thinking.. why not `Wordpress` only? Because I love `Firebase` features for mobile apps!\n\n## Features:\n- fully customizable\n- integrated with `pm2` for auto-restarting, deployment and auto-scaling\n- rate limiting \u0026 brute force protection (uses redis in production to maintain banned users)\n- anti-ddos protection\n- bot protection (throws `404` for bots and crawlers)\n- integrated with `cloudflare` protection\n- saves logs to file\n- accept requests only from custom user agent (endpoint was used only by mobile app)\n- well integrated with [pmx monitor](http://docs.keymetrics.io/) \u0026 [new relic](https://github.com/newrelic/node-newrelic)\n\n## Endpoints:\n- status endpoint - `/fb/status` =\u003e `GET`\n- auth endpoint - `/fb/auth` =\u003e `POST` =\u003e format: `{\"username\":\"test\",\"password\":\"test\"}`\n\n## Requirements:\n- `WP REST API V2` enabled\n- [JWT Authentication for the WP REST API](https://github.com/Tmeister/wp-api-jwt-auth) enabled\n\n## Setup:\nI will be honest here. There may be some steps missing so you will have to figure it out yourself (I've stopped using it because mobile app which uses it is not developed anymore).\n1. Install `npm install --g babel-cli pm2`\n2. Clone repository\n3. Run `npm install`\n4. Modify settings in these files:\n    - `./keys/server.crt` \u0026\u0026 `./keys/server.key` =\u003e generate your own keys\n    - `./serviceAccountKey.json` =\u003e get whole file from `Firebase` project\n    - `./newrelic.js`\n    - `./ecosystem.config.js`\n    - `./dev_ecosystem.config.js`\n    - `./settings.js`\n    - `./package.json` =\u003e modify name of your app (if changed) in pre-defined commands\n\n## Things to keep-in-mind:\n- add your ssh key to deployment machine\n- configure `pm2` on your deployment machine (`pm2 link`)\n- you could install some useful plugins for `pmx monitor` on deployment machine:\n    (keep in mind that each of these has to be configured separately, also some of them are useless if you're not going to run `Wordpress` on same machine with `Login API`)\n    - `pm2 install pm2-server-monit`\n    - `pm2 install pm2-php-fpm`\n    - `pm2 install pm2-memcached`\n    - `pm2 install pm2-mysql`\n    - `pm2 install pm2-slack`\n    - `pm2 install pm2-logrotate`\n- you have to open some ports (for example in AWS security group =\u003e `2096` for API and `43554` for `pmx monitor` in my case)\n- if I recall correctly I had to exclude auth endpoint from `cloudflare` caching (somewhere on theirs website in domain settings)\n\n\n## Usage example:\n- Run setup first: `pm2 deploy ecosystem.config.js dev setup`\n- Then.. deploy!: `pm2 deploy ecosystem.config.js prod`\n- And save process to be run on next startup: `pm2 save`\n\n## Useful commands:\nYou can do all these steps above with one command `npm run pm2devcleandeploy`\u003cbr\u003e\nor if you already did setup you can do `npm run pm2devdeploy`.\u003cbr\u003e\nYou can also remotely destroy already running instances with: `npm run pm2devdeploydestroy`\u003cbr\u003e\nand read logs using `npm run pm2devdeploylogs` or clean them up with `npm run pm2devdeploycleanup`.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrptbl%2Fwordpress-firebase-auth-bridge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrptbl%2Fwordpress-firebase-auth-bridge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrptbl%2Fwordpress-firebase-auth-bridge/lists"}