We are developing an electron app using and reactjs and node. Google oauth2 is being used for signup and login. But we are not able to get back to the app after successful login. What is the right way to solve this. What is the return url that is to be given to return the user to the app?
Thanks in advance.
Ajey, I am also working in the same project. We are using the electron react boilerplate (https://github.com/chentsulin/electron-react-boilerplate) to build the application. We are not using any separate window for authentication. When click on the signin button, the application will redirect to the google authentication page and redirect to the url provided in the "redirect_uri" parameter.
Related
I'm developing a Xamarin forms mobile app (iOS). I would like the user of the mobile app to be authenticated by google auth in order to access WordPress (a.k.a. WP henceforth) Resources. I see the flow as follows:
User launches the Mobile App and is presented with the WP login screen where along with the WP login fields, there is a button that says 'Login with Google'.
Upon tapping on the 'Login with Google' button, the user is redirected to Google's login page where he/she enters Google credentials.
Google then redirects back in either one of the ways:
a. Google redirects to WP with necessary tokens which in turn redirects to the app with necessary tokens.
b. Google redirects back directly to the app with the necessary tokens.
Is this a valid scenario?
I know that Xamarin Forms has packages that support OAuth so that can be handled, but how would I go about setting this up between WP and Google Auth? What would the correct Redirect URL's be?
Appreciate any help that can be provided.
Thanks & Regards
Noel
I try to implement authorization via google in my applications but I have one problem.
In normal browser authorization works the next way:
Click on google sign-in button
Open new page with google authorization
Denied/Grant permissions to app
Page closed automatically
Page with google sign-in button reloaded automatically
But in QML WebView the last 2 steps doesn't work. Does anybody has ideas how I can do this?
Thx
Use this example for WebView OAuth2 authentication. Usually Websites use OAuth2 for authentication and authorization. The Example is for Facebook , but it can be applied for Google.
I would want to know how can I make user login OAuth via a UIWebView instead of Safari browser.
I've implemented Twitter OAuth with Deployd as backend, after making login with Twitter it redirects to my API url for a POST request and get stuck. It's not redirecting back to the application.
So any approach or suggestion would be greatly appreciated.
Any reason why you're not using the Fabric SDK? It makes it really easy to login a user via Twitter and it checks automatically if an account is set up in the System Settings. If there isn't one, it'll present the OAuth login option. In this way your user doesn't have to leave your app which is great.
We have an ios app that uses native Facebook login just fine.
Then we also have a website (app is basically an optimized client for it) where people can login via Facebook too. When they open our website in mobile safari, they are directed to Facebook pages to authenticate there and it works, but.. it is still far from native and users have to retype credentials they often have in ios already.
So could it be possible to to somehow launch system fb authentication for just a web page (maybe using some clever URL schema?) and get granted token back to web?
Difficult way
As described here http://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified#mobile-apps you could find URL scheme to trigger the native iOS app for app authorization:
fbauth://authorize?redirect_uri=[redirect_uri]&client_id=[client_id]&response_type=token
But if you call that link it's not possible to have a redirection. You could try to hack that redirection but maybe you could not find a way out.
A secure way to solve that problem is to use a SSO token to authenticate user on your App when he logs in, and next on Safari take a redirection, with a custom url to your APP, that do as bridge to FB App via Token stored in your APP. After FB authentication you can directly redirect user back to your landing page in Safari. As said by #Lego it's an alternative way to direct authenticate that could be made by going deep to custom URL used by FB.
No, it is not yet possible to directly authenticate the user via the native Facebook App, but it's possible to authenticate the user using a custom URL scheme which opens your native iOS app which then handles the authentication flow:
The user authenticates natively with your iOS App. You then store the user login (not password) in your app (i.e. using NSUserDefaults).
Then the user opens your web page in Mobile Safari. You redirect the user via a custom url scheme to your app (i.e. using myapp://authenticate). Apple documentation on implementing custom URL schemes: click
Now, if you have an active FB session in your iOS app, you can either directly redirect the user back to your landing page in Mobile Safari, passing the access token via url get parameter or you first re-authenticate the user, displaying a login view with the user name pre-filled, which you have stored in your iOS app before (step 1) and then redirect the user to your landing page, again all depending on session state and your security needs.
For opening face book app you can use Custom URL scheme. But i am not sure if u can authenticate user from it. In case if you could also then it will be confined up to the fb account which is already configured on that device app .so better try to use face book api or something
I don't get your question exactly but i think as per your question you want to create fb app Login in safari or in your custom web view.
is this perfect ?
as per my knowledge web view is different thing and native app is different thing.
if you are Login in web view then no need to check anything token or other thing because it will give you Logout thing there.
but if you are Login in your application then "developer.facebook.com" will definitely help you.
and yes, you will do most of the thing in your app as native facebook app do.
Hope it help....
I'm trying to achieve following: I have facebook authentication on my web app. I want to return back to PhoneGap application after authentication is done.
The authentication flow works just fine. But returning to app should be done by providing a redirect url to facebook authentication URL. The problem is that I don't know what's the URL.
I've tried custom URL scheme, which works when authentication flow is executed in external Mobile Safari window. But in this case, the authentication is set to the Safari session, not for the Web App.
If external window is not used, but the authentication is done in Web App, the custom URL scheme won't work.
I have a hint this could be done with PhoneGap ChildBrowser plugin. That's the last possible option I want to try
If the only possible solution is ChildBrowser, I haven't found any good tutorial or instructions how this should be done. Any advice on that?
please give solution if any one have better example
Phonegap released a plugin for connecting to facebook: https://github.com/davejohnson/phonegap-plugin-facebook-connect