How to access same firebase authentication using two different apps? + flutter - flutter

I have two different apps in same firebase (one for android and one for web). If an user triggers forgot password in my android app it will send a custom link to his mail. when he clicks that link he will be directed to my web app where he can enter the new password. But as he confirms the new password it is not getting updated in the firebase. I have tried all the methods mentioned in similar questions. Have added same google-services . Have initialized the web app with proper api. Is there any solution for this?

Related

How to add email&password login method to existing account that was created with a third party provider such as google/facebook on my firebase project

I just implemented Google OAuth social sign in to my firebase project today, and it works.
I have tested it with a new google account (with an email address that wasn't used yet in my firebase project), this worked.
I have tested it signing in with my usual google account, which uses the same email address as one of the accounts in my firebase project (with email&password login). In Firebase console I could see the Google logo got added next to the email icon on my user, this is exactly what I expected.
Now my problem is, I don't know how to add email & password login to an existing account, that was created with a third party provider.
To test this I have first created an account on my firebase project using google.
I have tried to sign in by using the same email address associated to that google account, which obviously wouldn't work as there is no password set.
I have tried to sign up (register) by using the email address, which would throw a FirebaseAuthException with the error code email-already-in-use.
And I have recognized a flaw in this logic^^: Let's say Bob creates an account on my firebase app with Google. Then just about anybody could use his email address and a new password to register, and therefore login to his account. A correct solution is to only allow the user to add a password while signed in or by requiring authentication.
I couldn't find any relevant method on FirebaseAuth.instance that could be the answer to my question.
I have noticed that many apps with social logins provide the Apple login ONLY for their iOS app.
If I do the same, the worst case scenario I can think of which is caused by this problem is:
Someone with an iPhone downloads my app and creates an account with Apple login.
Then that person switches to Android. Now that person can't use Apple login, and also can't log in to my app with their email address.
So for now, I have to include Apple login for my Android app too, and I don't see a reason why I should not do that. But I still want to find a solution to my question, as that could be an annoyance to users of my app.
See this video from the official Firebase YouTube account.
I want to clarify, my questions is different from this, so don't redirect me to it.
I have just found the answer to my question and implemented the funcitonality in my own project.
This webpage from the official firebase docs explains exactly how to do that.

How to make profile as link to share

I am going to create a chat application using flutter with the firebase database, I want to add a profile sharing feature that opens a specific profile by its profile link, e.g. In Telegram, we have our own profile id and we can share it as https://t.me/username, just of one click it opens with telegram app with that specific user profile. Then how do I do this?
Firebase Dynamic Links
Firebase Dynamic Links is the service that does what you're describing. The documentation states the following:
You create a Dynamic Link either by using the Firebase console, using
a REST API, iOS or Android Builder API, or by forming a URL by adding
Dynamic Link parameters to a domain specific to your app. These
parameters specify the links you want to open, depending on the user's
platform and whether your app is installed.
Setup
First, you will need to enable it for your Firebase project through your Firebase console.
Then, you will include its official package for Flutter called firebase_dynamic_links in your app.
You can create Dynamic Links programmatically with your app or maybe Cloud Functions or by using the Firebase console.
Use the firebase_dynamic_links package to check if a Dynamic Link was passed to it when your app opens.
You can view the analytics data to track the performance of your Dynamic Links in the Firebase console.

How to get data from Cordova's in-App Browser

I'm working on authentication for an Ionic 4 app. I'm using the in app browser plugin to login. After successful login an access token is sent back to the client. I can't figure out how to get the token from the In-App Browser to the app.
You can use an event listener such as :
this.browser.on('loadstart').subscribe(event => { this.checkForToken(event); })
Where checkForToken can look at your "event.url" and parse the token to be stored to localStorage or some other method to be used to login with once the in-app browser is closed.
Using events to listen for load start and stop was an awesome idea. I was, however, facing another issue. Google doesn't allow sign in using the In-App Browser and I really needed that. After asking around and looking at similar past issues I came across a Cordova plugin called BrowserTab. This was awesome as it's an instance/Custom Tab from chrome so it worked fine with google sign in. Another problem came up. You can't inject Javascript into BrowserTab and there was no way to programmatically close it once done. I looked around some more and that's when Deeplinks came to mind. I used the Deeplinks plugin and passed my access token as a parameter. When the user logs in, the BrowserTab redirects to a Custom URL scheme link for my app with the access token in the URL. Now it works perfectly. I've read somewhere that IOS is getting rid of Custom URL Scheme links. Luckily, it still has support for Universal App Links

Google assistant account linking with facebook

I'm trying to make a chatbot with Dialogflow for Google Home. It requires the user to input a URL. Now it will definitely be a long and complicated URL which I can't recreate and I can't have the user speak into the google home.
The idea I had was that the user would input the URL on an agent on messenger. I store this on a Firebase database and then access it with a second agent.
Now the issue I have is authentication, I was hoping to use account linking on my google action with facebook. But I can't login to Facebook with google home. Or if I can, I can't find any documentation specific to that case. Facebook doesn't provide the necessary client ID and secret(as far as I can see).
I managed amazon and Gmail account linking with Alexa and an Amazon Echo. In those cases, you would have to login to google or amazon on the Alexa app or webpage. Then this will be integrated with your Echo and the skill will become usable.
Anyone have an idea of how I can make the link happen, if not then anyone have an idea as to how I can solve the overall problem?
This question has been left unanswered on other forums, but I was hoping to either get it solved or find an alternative.
There are three approaches to solving your overall problem - getting the URL manually entered and available to your Action. Two of them tackle it the way you've suggested - involving authenticating to Facebook and tying that to the Assistant account somehow. One solves it entirely inside the Assistant.
Account linking to the Facebook account
You've tagged firebase-authentication, so I'm going to assume that you're using it to do the auth and you've enabled Facebook login through it. This means your user has a "Firebase Account", but they log into that account using Facebook.
I will assume you have a way to get the URL from messenger once they're logged in.
The trick in this case is to setup Account Linking between their Firebase account and their Assistant account. This is done by setting up an OAuth2 server that has access to the Firebase accounts and will create authorization and refresh tokens that are given to the Assistant.
In the Action, you'll send the user to the Sign In helper, which will redirect them to your login page and send back a one-time auth code to the Assistant. The assistant will then use your OAuth2 server to exchange this code for auth and refresh tokens. Periodically it will use the refresh token to get new auth tokens.
When the user returns to the conversation through the Assistant, you'll be handed an auth token and you can use this to lookup the user. Since you also know their Facebook account, you can get the URL via however you planned to do so.
There are drawbacks to this method - it is very complicated, and setting up your own OAuth2 server is not for the faint of heart. You may be able to use something like Auth0 instead of Firebase Authentication to accomplish the same thing, but then you don't have the ease of access to the Firebase database.
Account linking to both Facebook and Google
In your Firebase account, however, you don't need to limit them to just logging into Facebook. You can have them use Firebase to record both the Facebook and Google accounts that they're using. This would "link" the two accounts together in your system.
With this, you don't need to setup an OAuth2 server. Instead, you can have the Assistant use Google Sign In for authentication. If the Google Cloud Project that Firebase is using and the Assistant are using are the same project, then once the user has logged in to your project's web page with their Google account, you'll get an identity token on the Assistant which will contain their Google ID. You can use this to match up with their Firebase account and get the Facebook ID and proceed from there.
But this is still a lot of work and kinda messy, jumping between systems.
Using just the Google Assistant (and maybe a web page)
If you're willing to make some assumptions about the devices your users are using, then you may be able to do it all just using the Assistant. The Assistant doesn't just run on the Google Home and other smart speakers, it also works on most current Android and iOS devices.
So you can detect if they have such a device available and, if they do and they're not currently on it, direct them to switch to that device when you need the URL.
If they don't have such a device available (perhaps because their version of Android is older), and you think this may be a common scenario, you may need to make another entry source available. This could be one of the solutions above, or you may want to just have a simple web page (done via Firebase Hosting and Firebase Functions, perhaps) where they log in using their Google account (so you get their ID) and you let them enter the URL. If you just need a URL - going through Dialogflow may be more complexity than you need.

how to integrate app id to my existing microservice

I have a microservice which is running in docker container, can I integrate app id into my application? and do not change the application code.
Also, I only saw google and facebook login item on the log in widget,
how can I add IBM w3id to the widget?
can I store a username and password into appid? then clients can login using the pre-stored credential. how to implement this? thanks.
There should be no any problem to secure your application using App ID, but you need to update the application (backend) code if you need to protect REST APIs. If you need to authenticate your mobile app users only, there is no need to change the backend code (you can review our iOS and Android onboarding samples available in the service dashboard).
IBMid is not released to production yet, so currently there is no option to add it.
About customer credentials - we're working on Cloud Directory feature now, this scenario will be supported once we release it to production.
Thanks,
Vitaly