可以像这样将 Auth0 集成到 Firebase 吗? [英] Is possible to integrate Auth0 to Firebase like this way?
问题描述
我正在 VueJs 中构建一个应用程序,我正在寻找执行身份验证部分的最佳方法,还有一个正在进行的 API 需要对受保护端点进行令牌验证.我想知道是否可以通过 Firebase 是 VueJs 应用程序和 Auth0 之间主要通信中心的方式将 Auth0 集成到 Firebase(与 API -> Firebase -> Auth0 相同).
I am building an app in VueJs and I am looking for the best way to do the authentication part, there is an API in progress as well that will need token verification for protected end points. I would like to know if is possible to integrate Auth0 to Firebase in a way that Firebase is the main center of communication between the VueJs app and Auth0 (the same thing with the API -> Firebase -> Auth0).
我问这个是因为我想确切地知道我是否可以使用 Firebase 工具保存一些代码行和性能,以便在不直接连接到 Auth0 API 的情况下从 Auth0 获取我需要的内容.另外我想使用 Fire Store 来保存我从 Auth0 获得的令牌.
I am asking this because I would like to know exactly if I can save some lines of code and performance using Firebase tools to get what I need from Auth0 without connecting directly to Auth0 API. Also I would like to use Fire Store to save the tokens I get from Auth0.
有可能拥有这种架构吗?
is possible to have this kind of architecture?
这是一张图表,可以更好地理解所希望的结果,希望不要混淆.https://ibb.co/68tpw8L
Here is a diagram for a better understanding of the wished result, hope is not confusing. https://ibb.co/68tpw8L
谢谢!
这些链接是我通过 Google 找到的最接近的解决方案.但根据我发现的信息,您可以执行此操作,但使用 Auth0 作为我的主要网关,但我想要相反,使用 Firebase 作为主要网关.
These links are the closest solutions I found thru Google. But according with the info I found you can do this but using Auth0 as my main gateway but I want all the contrary, using Firebase as the main gateway.
https://firebase.google.com/docs/auth/web/custom-auth#before-you-beginhttps://auth0.com/docs/api/authentication#delegationhttps://firebase.google.com/docs/web/setuphttps://auth0.com/blog/developing-real-time-apps-with-firebase-and-firestore/
推荐答案
Auth0 已弃用/delegation 端点,该端点用于为第三方供应商获取令牌.https://auth0.com/docs/migrations#api-authorization-with-third-party-vendor-apis
Auth0 has deprecated the /delegation endpoint which is used to get the token for third party vender. https://auth0.com/docs/migrations#api-authorization-with-third-party-vendor-apis
作为一种解决方法,请使用 firebase 自定义令牌身份验证机制.https://firebase.google.com/docs/auth/admin/创建自定义令牌https://firebase.google.com/docs/参考/js/firebase.auth.Auth.html#signinwithcustomtoken
As a workaround, use the firebase custom token authentication mechanism. https://firebase.google.com/docs/auth/admin/create-custom-tokens https://firebase.google.com/docs/reference/js/firebase.auth.Auth.html#signinwithcustomtoken
要创建自定义令牌,如果您没有后端服务器,可以使用 firebase 函数.
To create a custom token, you can use the firebase function if you do not have a backend server.
以下 auth0 博客中描述了整个流程,其中包含一个完整的项目.
The entire flow is described in the following auth0 blogs with a complete project.
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/
这篇关于可以像这样将 Auth0 集成到 Firebase 吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!