Is possible to integrate Auth0 to Firebase like this way? - firebase

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).
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?
Here is a diagram for a better understanding of the wished result, hope is not confusing.
https://ibb.co/68tpw8L
Thank you!
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-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/

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
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
To create a custom token, you can use the firebase function if you do not have a backend server.
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/

Related

secure authentication in Nuxt3

I am implementing an app using Nuxt3 and Firebase.
Currently, the authentication is using a plugin. The problem is that to define firebase tools in the plugin I have to use a public variable containing the API keys etc ... So everything looks to be visible into the client side.
I am looking for a secure way to implement auth on the server-side. How can I proceed to avoid any problem ?
Thanks for help
If you are concerned that your firebaseConfig is exposed on the client side, that's fine.
As answered in this thread, that config simply identifies it on the firebase server.

is there a way to add registrationids for FCM topics using firebase console

I want to send notifications to a set of users whose details I have in a CSV, in my research, I've found that using topics is a way to go about this.
i want to accomplish what this link is doing but using firebase console. is there a way to import registration ids and group them in the console itself?
There's no way to register an FCM token for a topic in the Firebase console.
I usually have a small Node.js script locally that uses the Admin SDK to register a token to a topic, which isn't much more than (for Node.js):
getMessaging().subscribeToTopic(['my_token'], '/topics/mytopic')

How do I connect my Firebase database to a Google script?

I am trying to put pictures that are on Firebase into a google Drive by using google App script. I've no code, I only tried reading the documentation, but it seems to be deprecated. There seems to be a way to use an Oauth token but I could not find a token on my firebase database.
I go into a lot of detail about using OAuth2 and service accounts with Google Apps Script in this story on Medium.
I suppose you want to use Firebase storage? The approach should be similar:
Create a service account
Use the OAuth2 library to generate a Bearer token
Use that token with the API call via UrlFetchApp
It would help if you shared more details on what you're trying to achieve, but this should set you on the right track.

React native + Firebase cloud function: Keep user loged in?

I'm working on a React-Native, Expo and Firebase project. I have built my firebase functions as cloud functions. The login, signup and register are built as a cloud function aswell. I'm using Email and Password to authenticate/signup the user.
I have used the method to store the token on the device and log the user in if it exists. However the token expires after 1h and after that my method does not work.
I have tried to use
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION)
but that does not seem to work with cloud functions and returns error code: The current environmet does not support the specified persistence type.
What kind of workaround for this problem is there? Building a seperate cloud function that only refreshes the token, and in that case how do i achive that? What pros and cons is there for different solutions? Thankfull for feedback and
thoughts.
According to React Native Firebase's documentation, setPersistence method is not supported in React Native, link is mentioned below.
https://rnfirebase.io/docs/v5.x.x/auth/reference/auth#Unsupported-Methods
You can check this answer if this may help you,
https://stackoverflow.com/a/46143694/11758792

Firebase Admin SDK create user using providers

I am trying to create a REST API for my app using Firebase Cloud Functions. I know how to use Admin SDK in Cloud Functions. It does have API to createUser. My front end app lets users sign in using Google and Facebook but I am not sure how to put it all together.
My app has successfully implemented Sign in with Google and Sign in with Facebook but how and what data do I transfer over to Cloud Functions (or any REST API Server for that matter) so that it could create a user in Firebase with appropriate provider.
Update for more explanation
I am creating an app for iOS and Android with some sort of cloud based backend. Right now I am experimenting with Firebase but I do not intend to tightly couple my apps to Firebase and hence do not want to pull Firebase-iOS and Firebase-Android SDKs into my app code. I want the ability and freedom to switch my backend over to AWS or Azure without changing frontend code.
The one (and only?) way is to create a server that will expose REST API endpoints and do the work on my behalf that usually SDK does. To achieve this, I am using Cloud Functions but that shouldn't matter as long as I have API to talk to actual cloud.
After putting that explanation, now my question is how do I let my users login to app using external providers like Google and Facebook and still achieve what I am trying to do. When I let users sign in with providers, I do not have their password to send to backend to create a new email/password user.
The sample code that best illustrates what you want to do here on GitHub.
It shows how to create an Express app that handles HTTP request pages. Learn more about Express to configure it for wildcards are needed.
It accepts and checks authentication tokens in HTTP requests from Firebase Authentication to validate the end user responsible for the request.

Resources