Authenticate Angular 4 app with Firebase

时间:2017-08-04 12:29:52

标签: angular authentication firebase firebase-authentication firebase-security

I've created a form in angular where users can enter some data. These users don't need to authenticate in order to use this form. So technically every user that calls this online form is able to send data.

As Firebase is being used as backend, I need to somehow authenticate my angular project with it. I don't want to allow read / write operations to everyone, so there must be some sort of minimum auth.

Now I know I could enable email/password authentication, and store these credentials for my app, but this somehow seems quite cheesy.

Is there a more elegant solution to this?

Thanks

EDIT:

I'm authenticating via email/password now. So I've created email/password credentials in firebase console, and use these in my application to authenticate. Thanks to all.

2 个答案:

答案 0 :(得分:1)

Make use of Firebase Authentication Via Google or Facebook etc.. Check this page for reference.

The prerequisites you need to set this up in Angular

A Full Working Example.

You can also find link to that code over in that page

答案 1 :(得分:0)

我并不完全明白你想要什么。您需要经过身份验证的访问权限,但不希望电子邮件/密码或联盟(Google,Facebook等)登录。为什么不使用匿名登录?通过匿名登录,如果以后需要,您还可以稍后将用户升级为非匿名用户。