I'm using a react-app that uses Twitter's OAuth API which grants access to a user's Twitter account. However, when the app is used on mobile it only opens the auth URL in the native Twitter app rather than on the browser. An example URL would look like this:
https://twitter.com/i/oauth2/authorize?response_type=
Is it possible to add a parameter in the URL above so that mobile phones know not to open it in the native Twitter app? If not, is there anything I can do with things like window.location, window.document.location, window.location.assign, window.location.replace to prevent this from happening?
Related
Google oAuth is not supported in android webView. Google recommends to use chrome custom tab for proceeding oAuth. I have also requirements of js call from my web app to native. How to configure to call native methods from web app using chrome custom tab in android similarly like js interface in webView?
Update 1
This mod Chang marked the post as duplicate but the post is different. I don't want to run any JS in my web app from native. I want to invoke method from web app to my native code via JS interface. Is there any way for CCT?
Based on Can I Inject Javascript Code into Chrome Custom Tabs the answer appears to be no.
Chrome Custom Tab is based on Chrome itself and has the same security model. The web content is only allowed access to the Web APIs (camera, device orientation, etc.) and has no access to the native app. At best the native app can capture a URI.
Even the Chrome Custom Tab documentation state that the way for a native app to handle content:
Some URLs can be handled by native applications. If the user has the Twitter app installed and clicks on a link to a tweet. She expects that the Twitter application will handle it.
Before opening an url from your application, check if a native alternative is available and use it.
Implies that either a native app handles a URL or not. My interpretation of Chrome Custom Tab is a skinnable Chrome component adjacent to the native app rather than internal to a native app like a WebView where a Javascript bridge exists.
Your desire for a Javascript bridge from a web app would mean that there would be a arbitrary way for any website code to interact outside of the web container. The rational as to why that is not allowed is given as the responses in the first link.
I'm using facebook and google plus login in my website and it is working fine at all devices except Iphone, I make a lot of searching I found that google has been block native apps from make authentication since 2017
update : the website I'm developing is a splash screen that opened to the user when he try to connect to cisco meraki access point to authenticate him and give him access to the internet ,
when an iphone mobile try to connect to the access point the splash screen opened in the native browser of it so the facebook and google plus buttons doesn't work
Do you have any suggestions or solutions about that issue?
I recently resolved this issue on a website I manage with these steps:
login to console.developers.google.com,
EDIT your APP, under;
Authorized JavaScript origins, and Authorized redirect URIs,
Enter:
http://yoursitenamehere.com
https://yoursitenamehere.com if it has ssl and
Save
Refresh your page and try to sign-in now.
For facebook:
sign-in to your facebook developers platform
under facebook login
go to Settings
Valid OAuth Redirect URIs
(after filling your app domain details, Copy and Paste the code below Ctrl&Shift V) https://example.com/?SuperSocializerAuth=Facebook (replace the example.com with the domain name you're activating social login for)
I have to prepare an analysis about redirecting from a web site to the WhatsApp appication in the purpose to send a message. I read the documentation at https://www.whatsapp.com/faq/android/28000012 and I noticed the use of whatsapp://send?text inside the href attribute of a link.
I want to know the behavior of this feature when WhatsApp is not installed in the user device and I found nothing about in the documentation.
Thats what you called deep linking. Using hyperlinks to redirect to your app when installed and to play store (if deployed to play store) when not installed. One example that uses deep linking is facebook, but facebook uses http uri which you can choose to open to the app or to the browser as the http uri scheme is known to be a browser's uri. If you are using custom uri, then the deep link must be triggered by a browser. Refer Here for example using deeplink in chrome browser https://developer.chrome.com/multidevice/android/intents
I want to find a way to run native mobile app, from a web app on a browser, and communicate the result back to it.
For example, how does Facebook user authentication work on a mobile device? You go to login with Facebook on a website. If on mobile, it opens the native Facebook app to do the authentication, and redirects the user back to the mobile web browser to open some page, post-authentication. Somehow, web browser and native application are able to communicate? Is there also any security risk to this?
One way to do this is as follows:
Use a custom url to launch the app from the website (see link below)
Pass whatever parameters you need to the app (for example a return web site URL in the case of a login authentication type app)
Once the app launches and does it thing, have the app launch a browser using the return address URL you passed as a parameter to the app.
A good, well maintained, link to using custom URL's and passing partakers to the App:
http://iosdevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
I want to share my mobile browser url through whatsapp using custom button...is it possible?
Like that (When i click on button , mobile whatsapp open if it is there otherwise it will display "WhatsApp not Installed")
iOS
In iOS you can use a URL scheme for that.
In a nutshell, URL schemes are special URLs that are registered by native applications so that any other application navigating to that URL is forwarding their request to the native app associated with that URL scheme.
Check out this link on the whatsapp website which explains how to use the URL scheme.
Android
In Android you deal with this in a different way. Android uses Intents and Activities.
You can check out this to a similar question.
This will work