How to deeplink in Nextjs - next.js

I am currently using window.assign(bundlename://linkname) to deeplink a user into the app if it’s installed on their device but I keep getting Safari cannot open page because the address is invalid
I also tried to use window.location.assign = bundlename://linkname but that does not work either

Thanks for the detailed comments - I am able to open with document.location
See this sandbox, replace with an app scheme if you do not have Doordash installed - https://codesandbox.io/s/cranky-lewin-ydbp5?file=/pages/index.js

Related

Firebase Crashlytics links from mail, redirect to error-page, due to wrong Chrome user

Setup:
having a firebase project with crashlytics active
receive mails for crashes
try to open the crash from the link within the mail
Example link: https://console.firebase.google.com/project/xxx-8c64/crashlytics/app/android:com.example.project/issues/3fgdfgfdg9e86f653d84df9fdfdfdf3?time=last-seven-days
I have multiple accounts in chrome. One is my private, one is my work account.
My main account is the private one. (/u/0)
Now, once I try to open the link
result: get redirected to wrong user https://console.firebase.google.com/u/0/
expected result: asking which account I want to use to open the link
My current workaround is to stop loading the link in the middle and replacing the u/0 with u/1 and let chrome continue. This will load the link correctly. But it will not always work and is super cumbersome.
Is there anything I can do? Do some of you face the same problem?
(Besides logging in with my work account. No - I don't want to log out from my main and switch forth and back all the time)
Okay I found a way, although I would love to hear a better one.
Using a redirect chrome extension. Redirector
github Link
Chrome Extension Link
RegEx:
From: ^https://console\.firebase\.google\.com/u/./(.*)
to: https://console.firebase.google.com/u/1/$1

How to open Google Authenticator from a link?

I'm developing a website that requires a 2FA. We already permit to users to set it by scanning a QR Code shown in our configuration page.
My question is a bit more tricky. How can I permit user to open the app if he opens the page from mobile browser, ie. navigating from the phone with the Authenticator app installed?
I already have the logic to understand if the user is on mobile or not, but I don't find any solution that can replace the QRCode since the user cannot use the mobile camera in that case (he is using the phone to net on my website!).
I was searching the possibility to create a link that is recognised by an authenticator app (Google Authenticator or Microsoft Authenticator) but I didn't find a solution. Any idea?
After some research and trial, I found the link I was searching for.
In Google Authenticator (or any other app), the account are listed in the form:
Amazon(my#amazon.com)
123455
Google(me#gmail.com)
455234
Issuer(email)
554645
AnotherCode
142414
In order to generate a new entry without scanning the QRCode, a link in the form of:
otpauth://totp/dev#it.com?secret=123abc&issuer=StackOverflow
has to be opened. For instance, the link above results in the following entry:
StackOverflow(dev#it.com)
The link is opened by the phone using the installed Authenticator app.

"Browser or app may not be secure. Try using a different browser." error with Flutter Firebase Google Login

I am using flutter web and firebase authentication to build a web app. For that
1. Created Firebase app with Google signin as one of the sign in methods.
2. Added the dependencies as given in https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_auth/firebase_auth/example
and https://dart-pub.mirrors.sjtug.sjtu.edu.cn/packages/firebase_auth_web.
When I try to login, the Google sign-in window appears. Once I enter the email address and press enter, it gives the following error.
"Couldn't sign you in This browser or app may not be secure. Try using
a different browser. If you’re already using a supported browser, you
can refresh your screen and try again to sign in."
I used Chrome browser.
What should I do to make my app more secure ? For android, we had the option of using SHA keys to encrypt the connection. Do we need to do something similar for web ?
Incomplete answer:
This problem isn't specific to flutter. It happens whenever you try to sign in to Google in a Chrome instance that has debugging turned on. In other words, if you, your automation software, or IDE starts up chrome with a command like chrome.exe --remote-debugging-port=9222
If running Chrome normally (out of debug mode) is not an option, then try https://support.google.com/accounts/thread/22873505?msgid=24501976 or if you are using Electron then try https://support.google.com/accounts/thread/22873505?msgid=24503570 but I, personally, haven't been able to make these work for me, yet.
Please upvote the question at https://support.google.com/accounts/thread/25209002 if you want a solution to this problem that actually works.
The issue was with the chrome developer version Flutter use to launch as a device. If we open the same URL (localhost:portnumber) in the normal chrome, it will work without any issue.
The following worked for me:
Go into your google account
select Manage Account
Security
Less secure app access (need to scroll down a little bit)
set to off
Then I was able to login in and debug in IntelliJ
(for me, for some reason, I had to create a new google account, couldn't get it working with my existing account but it worked with my new account)
You can use user agent switch to switch another browser (for example opera).
https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg
They try login. Once you successfully logged in you can remove or disable the extension.
I had the same problem with Firefox. The only way I could fix it was to create a new profile. So you could try to run Firefox with -p switch and create a new profile.
firefox -ProfileManager
firefox.exe -p
Update: check the firefox config (address field: about:config)
be sure marionette.enabled is false
For Test Automation Users-:I saw many testers are facing this issue for sign in using Google but I think below my idea will save their time.
Best Work Around is as below-:
Open automated Chrome browser as shown below
Sign up with new details which you want to use.
Now after successfully completion of sign up.
Then use that email and password for signing into gmail using Selenium or any other test automation tool

Should I use Firebase Dynamic Links over Universal and App Links?

Im building an app for iOS and Android and need to open urls in the app on mobile and in the browser on desktop.
All links should open in the app if possible, so I cant generate one link for each possible url.
Can I do this in Firebase or do I have to create links in advance?
I'm not sure this question is related specifically to Firebase, or a general one.
I can try answering about the general case:
For opening in App:
In order to use Universal Links in iOS and AppLinks in Android, you'll need your click server to host Apple's AASA file or Android's asset file. This means that you'll need to serve that file for the operating system.
For opening in browser on desktop:
You'll need your click server to be able to detect desktop user agent and redirect you to store.
I didn't understand your question about: All links should open in the app if possible, so I cant generate one link for each possible url. Actually one link can fit all use cases, but you'll need to develop that capability in your own click server.

Firebase Dynamic Links do not survive app install on iOS 11.3.1

Firebase Dynamic Links do not survive on iOS 11.3.1 when user don't have installed. Anyone else experiencing this issue? This works fine prior to iOS 11.3.1
Repro steps::
Click on FDL link
User redirected to app store
User install app
User open app
FDL params not passed
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
//the url here returns:
//google/link/?match_type=none&match_message=No pre-install link matched for this device.
or
//google/link/?dismiss=1&is_weak_match=1
}
I've reported this to Firebase and they're still working on the fix.
https://github.com/firebase/firebase-ios-sdk/issues/1244
In the meantime, the workaround is to turn off the forcedRedirectEnabled.
FIRDynamicLinkNavigationInfoParameters *navigationParams = [FIRDynamicLinkNavigationInfoParameters parameters];
navigationParams.forcedRedirectEnabled = NO;
components.navigationInfoParameters = navigationParams;
or if you use the admin console to generate the link, you need to leave the Skip the app preview page setting unchecked.
Note that this means users will see one interstitial page before it redirect to app store, which is not ideal but at least FDL params will be passed.
Hope this helps someone.
Cheers!
I had the same issue.
And I found that when I delete FirebaseDeepLinkPasteboardRetrievalEnabled in Info.plist the problem is resolved
https://firebase.google.com/docs/dynamic-links/ios/receive
Optional: Disable the Dynamic Links SDK's use of the iOS pasteboard.
By default, the Dynamic Links SDK uses the pasteboard to improve the
reliablity of post-install deep links. By using the pasteboard,
Dynamic Links can make sure that when a user opens a Dynamic Link but
needs to install your app first, the user can go immediately to the
original linked content when opening the app for the first time after
installation.
The downside of this is that use of the pasteboard triggers a
notification on iOS 14 and later. So, the first time users open your
app, if the pasteboard contains a URL, they will see a notification
that your app accessed the pasteboard, which can cause confusion.
To disable this behavior, edit your Xcode project's Info.plist file
and set the FirebaseDeepLinkPasteboardRetrievalEnabled key to NO.

Resources