Using this example here works well for me to add Google authentication to my UWP app (more specifically, to my UWP project in a Xamarin Forms app). However, after authenticating and automatically going back to the app via the redirect URL, the browser tab that was opened for the google log-in remains opened (it gets navigated to google.com and doesn't close after switching back to the app). Anyone know how to close it (just that tab, of course) automatically?
Related
I have installed tron link wallet extenstions in google chrome browser. I have a web application. I need to open this tron wallet from browser to do transaction. I do not need to open tronlink extension in pop-up window. It is OK if it is opening in either new tab or in the same tab. This question might be duplicate of How can I open my extension's pop-up with JavaScript? or Activate popup.html from Content Script: Chrome Extension Development. But I am not getting clear answer there. My question is, Is it possible to open tronlink wallet from chrome browser by a click ? If we can, how to do it.
If you have a web application that need do Tron transaction (called DAPP) you can use Tron web API ( in javascript ) :
tronWeb.transactionBuilder.sendTrx(to, amount, from, options);
Full API reference
After I saved my PWA (Test App) built using Create React App to homescreen and launched the app in standalone mode on android using chrome and iOS using safari. Then in the app I initiate Firebase method signInWithPopup(GoogleProvider) the device asks me if I want to open the action with Test App or other browsers installed on device i.e chrome, firefox. If I select to open with my Test App the popup opens and I select the correct Google account.
Error: After the google account selection the popup closes without ever redirecting back to my Test App.
If I instead to open the Firebase method signInWithPopup(GoogleProvider) with chrome browser and not my Test App the popup opens for google account selection and after I select the google account the popup closes and redirects back to the Test App momentarily and then
Error: directs back to chrome tab where is asks for google account to select while showing a loading indicator, and just hangs there.
There are no console error or warnings that come up .
Note 1: The error of popup not closing and staying in loading also occurs if I add the App to homescreen on a Windows 10 x64 machine using Version 64.0.3259.0 (Official Build) canary (64-bit) and launch as a standalone window.
Note 2: The error also occurs for signInWithPopup(Facebookprovider) and signInWithPopup(Twitterprovider) Also If I uninstall app from Homescreen and launch purely in browser the signing in OAuth flow works fine.
Note 3: After further troubleshooting it seems the error more specifically occurs when user input is required in the OAuth popup.
i.e If for example if user has previously given the Test App permissions through Facebook, the flow works fine and the popup closes. Also if only a single google account is detected and it has previously given app OAuth permissions then the popup works as it should. But If multiple google accounts exists on device then the user has to input a selection of which account to sign in through --> this leads to the previously mentioned error again. And using Twitter OAuth the error occurs every-time because twitter popup requires user to select Authorize App every-time.
UPDATE: I believe this may have something to do with google chrome recent changes to OAuth from Webview.
GIf of the error on windows machine: notice the popup for twitter auth never closes, even after authorizing the app, same thing occurs for google and facebook OAuth.
Reading Google documentation:
https://firebase.google.com/docs/auth/web/google-signin
Authenticate with Firebase using the Google provider object. You can prompt your users to sign in with their Google Accounts either by opening a pop-up window or by redirecting to the sign-in page. The redirect method is preferred on mobile devices.
So you have 2 options:
firebase.auth().signInWithPopup(provider)
firebase.auth().signInWithRedirect(provider)
The second must be used when you are into a mobile device.
So the question is: How I detect when I running into a mobile device ?
Code must be something like:
if ( isInMobileDevice) {
firebase.auth().getRedirectResult().then(function(result) { .... }
}
else {
firebase.auth().signInWithPopup(provider).then(function(result) { .... }
}
Sorry, Im still searching the way to get the correct value (true/false) into "isInMobileDevice"
you can stablish in the manifest of the app "display:standalone" then detect the launch mode like this
function isRunningStandalone() {
return (window.matchMedia('(display-mode: standalone)').matches);
}
...
if (isRunningStandalone()) {
/* This code will be executed if app is running standalone */
}
Good news, fixed in Chrome Canary
https://bugs.chromium.org/p/chromium/issues/detail?id=771418#c84
I'm looking to intercept a web request and launch that URL in another instance of Chrome. We have a Google Apps for Business account. And I regularly receive emails with Google Drive links. But they open in the last browser that had focus, which can be my personal user window. I'm looking to have Chrome get that web request, then either automatically open the link in the right window, or prompt for a choice. Is that possible?
I need to create a web application which will be stored in the traybar of Windows, this to prevent users from accidentally close my application (without the need of a pre-close alert message).
I thought that Google Chrome's background apps could be the right way to go, mostly because I don't need cross-browser compatibility and I have to choose which browser my users will use to run this web application.
The only problem is that I don't understand if I can achieve what I need with this feature.
I've found only this example of background app in Chrome countdown app
But this app uses the "background page" feature, that is different from what I'm looking for.
How can I let a Chrome app be minimized in the traybar (or even in the taskbar would be ok) instead of be closed?
Try to use node-webkit (chromium + node.js) for it: https://github.com/rogerwang/node-webkit
It allow to create any web-app and it support tray icons: https://github.com/rogerwang/node-webkit/wiki/Tray
You can download my windows example app here: https://mega.co.nz/#!xQMzgbxD!S58G-V23QLNRDFC10xso41-T2V8OZQVsQEH-lr46R3s
If you want exactly chrome, try this NPAPI plugin example: http://minimizetotray.googlecode.com/files/SourceCode.zip from http://habrahabr.ru/post/73003/
Unfortunately, I don't think you will be able to achieve exactly what you're after. You might be able to combine the two solutions below to nearly achieve your requirements. However, I don't think the type of control you are after is available via Google Apps.
Google App Launcher
The Google App Launcher would fulfill the "stored in the traybar of Windows" requirement.
The Chrome App Launcher is the hub of all your Chrome apps and with it
you have quick access to all of your apps from the desktop. When you
install an app from the "For Your Desktop" collection of the Chrome
Web Store, you get the App Launcher. The App Launcher requires you to
sign in to Chrome to enable apps that need access to your Google
account.
Manage apps
When you download a new app that enables App Launcher, the apps from
your Apps bookmark on Chrome New Tab page will also appear in the App
Launcher. Managing apps in the App Launcher is simple.
Add more apps: Click the Chrome Web Store button in your apps list and explore the apps in the store.
...
Background: Extending Your App's Life
You mentioned background apps in your question but I would recommend you explore it further. It essentially provides the "prevent users from accidentally close my application" requirement that you stated. This isn't foolproof (see bold sentence below) but it is about as close to the requirement I think you will be able to achieve.
As of Google Chrome 10, the background feature lets a hosted app run
as soon as the user logs into their computer—before the user launches
Chrome or the app—and to continue running even when Chrome or the app
has no visible windows. However, if the user explicitly quits Chrome,
the browser and app both exit.
I have a chrome app which displays data pulled from website A.
If a user has the app installed, and is on website A, how can I make the chrome app detect that the user is on website A and then prompt the user to open website A in the chrome app?
I'm trying to mimic how Android does this if you try to open a Google Play Store URL for example.
Thanks in advance,
Dimitry
Your app needs to define a webRequest (part of permissions) in the manifest file. You might use the blocking response to then handle all the stuff yourself.