How to pass Login With Google Process in Cocoa WebView - objective-c

I am developing a cocoa app for Mac OSX. It's a basic browser application and I use webview component.
In the page I want to connect, there is standard Login with Google Account button in order to login with my existing Google Account. When I clicked on this button nothing happens.
The same functionality works properly when I visited the same page by using Safari or any other browser but there is no reaction on webview component.
I've checked the action behind the Google's login button and here is the JS code.
onclick="return Dialog.Login.loginWithGoogle(false, 'https://www.mywebsite.com/-/oauth2callback', 'https://www.mywebsite.com/')"
As a part of the standard oauth process the process also has many redirections after this URL is called and normally should be completed at my site's login screen as expected. However, webview doesn't handle this.
Please note that the web site I am trying to connect in my webview is not belong to me and I have no control on it.
I checked many solutions on the web for 2 days but nothing helped.
Any help/hint will be appreciated.

Related

Vue based Telegram Web App opens page outside of Vue path in Browser

I have a Vue-based Telegram Web App (API 6.x), which opens in Telegram App, clicking on the for Bot defined Button.
Now inside of the (one page, no router) Vue app I need to bring user to another, non-vue-based page.
Vue App > domain.com/game
Link to > domain.com/game/win
// inside vue component
<button #click="participate()">Participate Winning Game</button>
Participate Winning Game
As soon the User clicks on the link (or I do in participate() window.location.href/replace), Telegram asks the user to open /gam/win in Browser.
Is there a way to avoid this behavior and load /game/win inside the Telegram App?
Earlier I faced the same problem. Telegram Web App for Bot suggests opening any links in an external browser. I did not find documentation on the work of links in the application.
In my application on JS, I implemented a page redraw with new data received from the backend.
P.S. links to phones or other messengers like
Telephone
Skype
do not work at all.

3r Party AuthProvider - callback url redirect

My project includes the firebase sign-in methods: Twitter, Facebook, Google and Github.
I am using firebase.auth().signInWithPopup() to handle authentication and callback. It works fine when run in the browser:
in mobile, this is different. I realize that it opens a new safari window, but it does not redirect to the app home screen. How can we do that?
this is the project in the firebase console for the Facebook sign-in
I believe this is a known issue for home screen apps in iOS. The window that is opened is sandboxed from the home screen app. The popup is unable to pass back the result to the parent home screen app. Instead, you should use signInWithRedirect in that mode. I believe that should work.

Disable Twitter Universal Deep Links

Update: It appears Twitter has fixed this issue. Clicking the authorize button now works! Thank you all for the responses.
I have a UIWebView that opens and directs to Twitters Oauth/Authorize webpage. The user signs in with there Twitter details and authenticates the use of our application with there Twitter account. This process worked perfect before the release of Twitter 6.37 iOS application. What happens now is when the WebView detects https://twitter.com/oauth/authorize?oauth_token instead of staying in the WebView it opens the native Twitter application and dies. If you uninstall the Twitter application everything works as usually it staying within the WebView. How can I prevent this from happening? I want to stay within my UIWebView and not automatically open deep links. I have been reading about the new URL deep link changes in iOS 9, but not sure of how to stop them from my application to other native applications. Thanks for any help!
As a workaround, in twitter authentication screen we can use the Go button on iOS typing keypad instead of using the sign in button on web view until twitter fixes.
Please refer the attached screenshot link for clarity.
Screenshot for the workaround
I ran into this issue as well and figured out it was because my authorize endpoint was set to https://twitter.com/oauth/authorize?oauth_token="+oauthToken (I believe this was in the original documentation). If you add api as the subdomain: https://api.twitter.com/oauth/authorize?oauth_token="+oauthToken, it will no longer trigger the deep linking and load the twitter app.
My answer to this via a Xamarin question:
Unless Twitter removes/updates the apps section of "https://www.twitter.com/apple-app-site-association" to allow a bypass or a secondary oauth that is not in the apple-app-site-association file I do not see how you would do it. These files are signed and iOS handles them at an OS level.
I have not played around very much with the continueUserActivity delegate and the NSUserActivity object that is passed to apps launched from UNI links, but I do not see a way for the launched app (i.e. Twitter) to return control to the original app, and at that point the oauth call-chain would be broken anyway....
Unique. Unlike custom URL schemes, universal links can’t be claimed by other apps, because they use standard HTTP or HTTPS links to your website.
Secure. When users install your app, iOS checks a file that you’ve uploaded to your web server to make sure that your website allows your app to open URLs on its behalf. Only you can create and upload this file, so the association of your website with your app is secure.
Via: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html
I would report as an issue (bug?) to Twitter's Dev forum: https://twittercommunity.com

Google oauth not closing login page in mobile devices

I developed an application that uses the Google + API to authenticate the user using the following code snippet:
<div class="g-signin"
data-callback="loginFinishedCallback"
data-clientid="{My Client ID}"
data-scope="https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.profile.emails.read"
data-cookiepolicy="single_host_origin"
>
</div>
This basically displays a Google Sign in button and when the user clicks on it, another window opens and they sign in. In desktop browsers everything works great but in mobile devices the second window opens and after the user logs in, Google doesn't close the login window so the user ends up staring at an empty page. In other words the callback function never gets called because the mobile browser doesn't close the new (login) window. Is there a way to work around this issue?
This is the javascript file Google provides:
<script src="https://apis.google.com/js/client:plusone.js" type="text/javascript"></script>
Cannot comment--however I would like to see an answer for this question. I am having the same problem with Google login redirecting mobile devices to blank page. Desktop Google login works perfectly fine. I am using OAuth2.0.
EDIT:
I solved this problem for my own framework. After tracing through and using a ton of var dumps I realized where google's redirect was dying out. The problem was that when the page redirected from my site's control to Google's authentication control, my $_SESSION redirect was lost. My other social logins (FB and LinkedIn) work with this method, however I had to add a catch for google specific redirect. I checked if the redirect was set and if not, made sure to set it there.
I hope this helps with your problem.

How to launch Facebook with Button

Hey friends
I created a button on my app called: "Find us on Facebook". Right now I ran into a situation where I need the button to launch the Facebook application. I could really use some help such as launching the facebook application, detecting if there is a facebook application, and all the sorts of stuff like that, thanks
Some googling shows that the facebook app apparently registers to receive urls with the fb:// scheme. So you can construct a fb:// url (like, say fb://notes or something) and then ask the UIApplication object if it can open the URL. If it says that it can, then open it.
there is a tutorial and sample app at https://github.com/facebook/facebook-ios-sdk
Basically you need to try to call fb://profile/yourpageid to load the FB app on your page.
The sample app shows you how to do this and fall back to loading in Safari if the app is not installed on the device.