是否可以通过这种方式将Auth0集成到Firebase?

时间:2019-06-07 22:59:05

标签: firebase vue.js integration auth0

我正在VueJs中构建一个应用程序,我正在寻找进行身份验证部分的最佳方法,正在开发一个API,该API也需要对受保护的端点进行令牌验证。 我想知道是否有可能将Auth0集成到Firebase中,使Firebase是VueJs应用程序与Auth0之间的主要通信中心(与API-> Firebase-> Auth0相同)。

我之所以这样问,是因为我想确切知道我是否可以使用Firebase工具保存一些代码行和性能,以从Auth0中获得所需的内容,而无需直接连接到Auth0 API。另外,我想使用Fire Store保存从Auth0获得的令牌。

可能有这种架构吗?

这里是一个图表,用于更好地了解期望的结果,希望不会造成混淆。 https://ibb.co/68tpw8L

谢谢!

这些链接是我通过Google找到的最接近的解决方案。 但是根据我发现的信息,您可以执行此操作,但可以使用Auth0作为我的主要网关,但我希望相反,可以使用Firebase作为主要网关。

https://firebase.google.com/docs/auth/web/custom-auth#before-you-begin https://auth0.com/docs/api/authentication#delegation https://firebase.google.com/docs/web/setup https://auth0.com/blog/developing-real-time-apps-with-firebase-and-firestore/

1 个答案:

答案 0 :(得分:2)

Auth0已弃用/ delegation端点,该端点用于获取第三方供应商的令牌。 https://auth0.com/docs/migrations#api-authorization-with-third-party-vendor-apis

作为解决方法,请使用firebase自定义令牌身份验证机制。 https://firebase.google.com/docs/auth/admin/create-custom-tokens https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signinwithcustomtoken

要创建自定义令牌,如果没有后端服务器,则可以使用firebase函数。

在以下带有完整项目的auth0博客中描述了整个流程。

https://auth0.com/blog/how-to-authenticate-firebase-and-angular-with-auth0-part-1/

https://auth0.com/blog/how-to-authenticate-firebase-and-angular-with-auth0-part-2/