I am trying to make a request through Webview (webkit) within cocoa application to a secured website. After the webframe launched, an authentication dialog pops up in the Webview let user to type username and password. However, after user click login button, authenticate dialog disappeared, but no request is generated and send to the server, thus none of the webview delegate method can catch this event. The webview hang with no content in it in the end.
I tried to use the delegate method didReceiveAuthenticationChallenge and hard code my credential in this method to challenge the authentication dialog, the website let me pass through without the authentication dialog pop up. However, I need to let user to type in credential after authentication dialog pop up.
Any one has idea on how to implement a Webview that can handle authentication dialog login after user input credential? Or is this a Webkit bug that does not handle this workflow?
BTW, if I make the same request in Safari, I can see dialog popup, I entered credential, the browser proceed and server let me logged in.
Thank you.
Related
When I make an API request with JavaScript in Chrome and it requires basic auth (username/password), Chrome automatically opens a popup so the user can enter their credentials. After entering it once, it won't ask again for a while until the username/password is removed from the Chrome cache.
Is there any way to detect that this popup will appear before making a request (ex: check whether or not the basic auth for this API endpoint is cached)? I want to give a short message before the popup appears so the user understands why they need to sign in again.
I got an app that only contains a webview, pointing to a site with a login screen. The users of the app should be able to get notifications, but only if they are authenticated (logged in to the site in the webview). Is there any way to tell if the user of the app is authenticated to the website in the webView? Any way for the app to know if the user clicks the login button in the webview?
I know that we can override OnReceivedHttpAuthRequest in a custom renderer, but this is not triggered by the login screen of this website so it doesn't work in this case.
Any suggestions?
I am developing an hybrid mobile application using ibm mobilefirst platform.
I am using the custom authentication module example to implement the login module. The problem here is when the user closes the application the app gets logged out.
Is there anyway that I can implement so that the user will not be logged out unless they opt to click on logout button. In simple I am trying to achieve something similar to Facebook remember me option.
You could do something like this (very rough idea):
As part of your authentication flow, if the user has passed the authentication - store in either localStorange or JSONStore a "token" that will basically state that the user has previously logged in. Also save in the server's database using userPrefs something to validate the token.
Whenever the app launches, it will attempt to connect to the server. The environment will be protected with a securityTest so that the server will present a challenge - if a token exist it will attempt to verify it, if there is no token, a login form will display instead.
Assuming this is a first-time launch, if the login passed successfully then store a token in the device and store in the database its "public key"
The next time the app is launched the challenge will be presented again but this time, since we have a token - it will attempt to verify it. If verified - don't present the login screen, skip the rest of the authentication flow and display the secure content
Something like that...
Perhaps to create a 'better' user experience, on app launch also extend the splash screen duration while you're checking for the token, This can be done using this API method.
On logout, clear the token from the device and server.
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.
I'm using facebook connect for a little website. This is my pop-up request URL:
https://www.facebook.com/dialog/oauth?client_id=".$app_id."&redirect_uri=".urlencode($redirect_url)."&scope=email,read_stream,publish_stream,publish_checkins,offline_access,friends_checkins,user_checkins&display=popup
The problem is, I have to buttons: Login and Cancel. When I click on cancel I go back to the login page, instead of closing the window. Any ideas?
Thanks.
This is a desired behavior of OAuth Dialog no matter which button user is clicks redirection (to URL specified in redirect_uri) occurs.
Some of the reasons that window isn't closed by clicking on Cancel and additional notes:
Closing of windows not opened by script is blocked in most browsers by default.
Closing of window is a feature that require JavaScript solution and OAuth dialog URL provides ability not to rely on this.
You can use JS-SDK with FB.login which will provide this for you and will close dialog.