Flutter - Create sharable profile link - firebase

I am trying to create a Social media kind of networking Flutter app in which user can share his profile link. That link must redirect directly to user's profile if app is installed else redirect to link to download app. I am using Firebase as backend. Any resources or packages to work with?

You can use the package Share to enable the user to share their profile themselves. Its really easy to use.
If you would like to share a profile you will need to provide the navigational route to get to the profile screen, then provide the user's ID/data to get/view the desired data.
As far as getting a deep link to get the user to download the app if it is not installed, you can use firebase's dynamic link feature. You can customize what the link preview looks like and says. They have really good docs that you can follow.

You could use a Firebase dynamic link.
A dynamic link is basically a link pointing to possibly 3 resources:
Web URL
Android (Google Play) App ID
iOS (App Store) App ID
So once you configure it on Firebase (it's simple to configure), when the user access the link, Firebase will employ a decision tree to decide where to send the user.
In case the access is done on a mobile device, but if the app is not downloaded, it'll send the user to the store, and after returning from the store, will send the user to the correct path you've configured, following the link.
And on the app, you can implement the SDK to handle this link and when receiving this route request, redirect the user to the right profile they want to access.
I could go through the whole process, but I suggest you check the whole Firebase documentation:
https://firebase.google.com/docs/dynamic-links
In case you have a question on that where I can explain further, just let me know.

Related

Why do I get downloads from the US even though my app is only available in the German Play Store?

I recently released my quiz app in the german Play Store and I get some impressions/downloads from the US which is odd since it should not be visible to the Play Store there. I am using Firebase authentication and I also see that some users authenticate but in my database they don't have an account (username, avatar etc.) which also can't be because after you login with Google you get to a page where you can choose your username and in the second you reach to this site, a user document will be automatically created, but in some cases it does not get created.
I noticed this behavior since my app was in beta testing.
Is it a normal behavior that there are some users who can see and are able to download an app that is usually only available in one country?
It can happen because google play console generates pre-launch reports for your app, so I think they use dummy accounts to login into your application. It can also happen when you submit an update to your app and it goes through a review process.

Firebase dynamic links not working for Firebase sign in with email link (password less)

I'm using Firebase sendSignInWithEmailLink with the url generated as part of the Firebase dynamic link.
The firebase dynamic url looks like:
e.g: https://myapp.page.link/H1c4
The url from step 1 is sent as part of sendSignInWithEmailLink
User received email and clicks on the verification link.
At the end of redirection I can see that the url contains the oobCode as shown below:
https://myapp.page.link/H1c4?apiKey=&oobCode=YG2N2eLU4qGBsDeLU5cVsDrzF9qwkGzoUepInuA9pm0AAAFtfk41Nw&mode=signIn&lang=en
When my app receives the dynamic link finally, it is loosing the oobCode. My app gets
https://myapp.page.link/uEOBUnv1k4XclzwfsT5NXnGBgAA3/
The part after link/ is a custom data which I used while generating the link in step 1.
When I use isSignInWithEmailLink for validating the link in step 5, I get the result as FALSE indicating it's not a valid email link.
But if I provide the full URL from step 4 in the code(manually), the isSignInWithEmailLink returns TRUE.
I think I've done all required but Firebase dynamic link is not persisting the oobCode as part of the link sent to the app on the device.
Has anyone seen this and know what could be the problem? keen to get feedback here before reporting as an issue in Github.
Cheers
Are you using a custom dynamic link with a path, eg. https://myapp.page.link/H1c4? If so, that is currently not supported with Firebase Auth. Only custom domains with no paths are supported, eg. https://myapp.page.link.

Google Oauth client was deleted. can I restore a new one?

We running a wordpress website use google oauth for third-party social login. (via WP Social Login plugin.) Former engineer is leave, and we cannot have past google account credential.
We face a problem shows:
Error 401
Error: deleted_client
The OAuth client was deleted.
but we can only see old client id and secret from website admin panel.
I wanna to know,
if we set up a new google oauth application id/secret, will it make user crash from login website?
Or, is it possible for us to restore/retrieve former application ownership and make it live again?
This happened to me when I was working on an Add-On (maybe not completely related to this question but similar). I mistakenly deleted a Client ID that I thought we weren't using.
How I solved it:
Created a new project in Google Cloud
Associated the Apps Script project (Add-on) to this new Google Cloud project
Then I re-associated the App Script project with my previous Google Cloud project
The previous step will re-compile, create and associate the Client ID to the App Script project. It will contain all settings from the Client ID manually created and associated with your project in the code.
Maybe this will give some light to anyone having a similar problem.
Here use this link:
https://support.google.com/cloud/answer/6251787?hl=en
You have to reach google and they will help you out, this is the only solution you can do.
In my case, the simplest/only path (though certainly not ideal) ended up being to create a new Firebase project and start using that.
This of course can be problematic if you have a lot of data to move and/or a nontrivial data schema - say, with nested collections. For me, it was worth the effort to get unblocked from Sign-In suddenly failing to work.
... ah, OAuth fun
=======
If you are trying to make the new Client ID work .. though it's not a total solution, but after searching for a while, found this config option in Firebase console - where you enable Google Sign In.
So if you generate a new OAuth Client ID, update the ID & secret there.
After I did this, it went from a 401 error to a 400 mis_direct , which I think was step in the right direction.

Firebase invites - facebook and twitter options

I have Firebase invites working with email and SMS just fine. I'm clueless when it comes to sharing via Facebook or twitter however. What are my options for sharing data with invites to facebook via Firebase? I can't find any info on this anywhere - except that Facebook offers its own invite api. I'm trying to just use Firebase if possible though, so I'm just trying to figure out how to customize the "share sheet" that I see referenced in various loctions online (without much info associated with those references). I can't tell if the share sheet is just a list of actions that I need to handle my own way, with just the email and sms option handled by google and I handle the rest of the options using the various apis out there.
In my current implementation, I use the deep link that the invite exposes and store the id of some data that I want the specific user to have access to. Then store that data in a firebase database. But what is the correct method to share to facebook users? Is it to just use facebook's api and expose it somehow in my own "custom share sheet"? Where can I find documentation on the share sheet?
Thanks for clarifying any of this if you can!
Cheers,
Mike
Currently I believe the only way to share to sources other than Email & SMS you would need to implement your own custom sharing functionality. It's hinted at in the Invites Documentation Best Practices section titled "Build a Custom Share Sheet".
Firebase Invites is built on top of Firebase Dynamic Links so if you want a link that takes the users to the app store to install your app you can create a simple dynamic link using one of these methods.
For implementing custom share sheets it depends on your platform as each has a different way of implementing sharing functionality.
My answer might not be ideal as I am looking for an alternative as well, but you could manually add different social media shares manually. What I wanted to do was send a deep link using the share feature already implemented by google but with no luck.
// Regular share I want to use this and send deep link :(
Intent myShare = new Intent(Intent.ACTION_SEND);
myShare.setType("text/plain");
String shareBody= "Messsage here";
String sub = "Title";
myShare.putExtra(Intent.EXTRA_SUBJECT, sub);
myShare.putExtra(Intent.EXTRA_TEXT, shareBody);
startActivity(Intent.createChooser(myShare, "Share using"));
/FACEBOOK SHARE
/*ShareLinkContent content = new ShareLinkContent.Builder()
.setContentUrl(Uri.parse("deeplinkhere"))
.build();
ShareDialog shareDialog = new ShareDialog(HomepageActivity.this);
shareDialog.show(content);*/
// Google Invites
/* Intent inviteIntent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.setMessage(getString(R.string.invitation_message))
.setDeepLink(Uri.parse(getString(R.string.invitation_deep_link)))
.setCustomImage(Uri.parse(getString(R.string.invitation_custom_image)))// the image address on server for invite by email.
.setCallToActionText(getString(R.string.invitation_cta))
.build();
startActivityForResult(inviteIntent, REQUEST_INVITE);*/
//startActivity(new Intent(HomepageActivity.this,InviteActivity.class));

Do OpenGraph Actions have to be approved before they can be used in testing?

I've created an open graph action, and so far I can only seem to use it to post the test page that Facebook has generated for me (I'm messing around with curl and a webserver serving the correct kinds of metadata).
Is this a restriction on actions (where, for sandboxed applications, only actions which have been approved can post real updates to a timeline), or am I likely looking at a bug?
In the app dashboard, you can create roles. Create one test user. After you log in from the test user (that will log you out from your original account), you can test freely. Or else, you can not post for global users unless your actions are submitted (via app dashboard -> open graph) and approved.

Resources