# Custom authentication - mobile numbers

**URL:** <https://forum.bubble.io/t/custom-authentication-mobile-numbers/849>\
**Category:** Uncategorized\
**Created:** [December 18, 2015, 7:51am UTC](https://forum.bubble.io/t/custom-authentication-mobile-numbers/849 "2015-12-18T07:51:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gurun](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/gurun/32/458_2.png) [@gurun](https://forum.bubble.io/u/gurun)\
**Post date:** [December 18, 2015, 7:51am UTC](https://forum.bubble.io/t/custom-authentication-mobile-numbers/849/1 "2015-12-18T07:51:19Z")

</div>

Many projects would at some point require a mobile-id centralized login instead of email as a primary username.  
In many projects nowadays, users are less willing to login with email and more willing to register with phone-numbers.

I know its possible to build vanity-logins through mapping the login form so that it fetches the useremail and logs in with that as a hidden field. But I guess this is not very optimal.

I understand that its possible to set-up your own oauth server but this seems pretty complex and not very user friendly at userlogin (oauth strategy via external weburl).  
After some research throughout the firebase documentation it seems that with a serverside script you could issue auth-tokens.

My idea for how to solve this in bubble:

Userid and password(hashed) is stored in bubbles firebase db, alongside with the rights assigned for each user.  
The login form from bubble frontend does an ajax request to a bubble-serverside script whom has full access rights to the usertable in firebase. After validating correct phonenumber and password with db, the serverside script fetches the roles/rules and generates a new auth token whom is passed through ajax to frontend-client, and from there it is appended as an auth-token to the browser (in cookie or localstorage). The view can now make valid firebase calls.

> **[googlearchive/firebase-token-generator-node](https://github.com/googlearchive/firebase-token-generator-node)**
>
> Firebase Token Generator for Node.JS. Contribute to googlearchive/firebase-token-generator-node development by creating an account on GitHub.

  
[https://www.firebase.com/docs/security/api/rule/auth.html](https://www.firebase.com/docs/security/api/rule/auth.html)

(Pardon me if not described well, but very very tired right now and just wanna sleeep…)

Any ideas to how one should solve this if done myself, eventually how could Bubble solve it for the users`? Let me know if there is any NodeJS`ers here that wanna play around with this in the Bubble chat!

---

<div class="post-metadata">

**Author:** ![emmanuel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/emmanuel/32/27657_2.png) [@emmanuel](https://forum.bubble.io/u/emmanuel)\
**Post date:** [December 20, 2015, 4:27pm UTC](https://forum.bubble.io/t/custom-authentication-mobile-numbers/849/2 "2015-12-20T16:27:39Z")

</div>

Yeah right now we use emails as identifier. We could look into changing this, but it’s not a super quicky fix, so we can’t really commit on doing this very soon. In the meantime, the non optimal way does work.

---

<div class="post-metadata">

**Author:** ![David\_Griffin](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/david_griffin/32/77443_2.png) [@David\_Griffin](https://forum.bubble.io/u/David_Griffin)\
**Post date:** [January 26, 2021, 8:48pm UTC](https://forum.bubble.io/t/custom-authentication-mobile-numbers/849/3 "2021-01-26T20:48:19Z")

</div>

I’d like to second this request and would challenge the statement that changing this is “not a super quick fix”. Though it may consume some resources, the value add offered is huge!

- It would allow Bubble users to integrate their application in many different services
- Connecting to services such as Firebase, would become very easy ([https://firebase.google.com/docs/auth/web/custom-auth](https://firebase.google.com/docs/auth/web/custom-auth))

As of today, the functionality around users stored on bubble is very limited and is likely to cause projects to fail OR for teams to decide at start to use a different service alltogether.
