It's possible to do fb OAuth2 in qml without QOAuth2AuthorizationCodeFlow? - oauth-2.0

It's possible to do fb OAuth2 in qml without QOAuth2AuthorizationCodeFlow?
I try to visit fb login page used WebEngineView by url.
I follow fb developer doc https://developers.facebook.com/docs/facebook-login/guides/advanced/manual-flow.
But I always got error page.
WebEngineView {
id: webView
anchors.fill: parent
url: "https://www.facebook.com/v14.0/dialog/oauth?
client_id={my test app id}
&redirect_uri={https://www.test.com}
&state={{st=state123abc,ds=123456789}}"
}
I change the url to
"https://www.facebook.com/v14.0/dialog/oauth?client_id=my App Id&redirect_uri=https://www.test.com/login&state=st=state123abc,ds=123456789"
And it success to open login window!

Related

How to make angular MSAL open up login redirect in Capacitor in-app browser

I'm trying to integrate my azure ad b2c login direct in my capacitor iOS app. I currently have it working all correctly, but it forces the user out of the app to log in to their account on safari, and then it navigates back to the app.
As such, I was wondering if anyone could point me in the right direction on how to either 1. transfer the loginRedirect to capacitor's in-app Browser using Browser.open() or 2. Embed the login page directly into the app, which will then navigate to the main application after login is complete.
Using something like:
"server": {
"allowNavigation": [
"*"
]
},
embeds the login page into the app directly (which is great!) but when I try and login, it gives me the error
WebView failed provisional navigation
⚡️ Error: unsupported URL
This is confusing because the login process works fine when using safari for the app, so I don't know what is going on here.
Any advice or tips would be helpful.
Thanks!

How to close ASWebAuthenticationSession with redirect to external website not to app universal link

I have an authorisation flow that at the end redirects to our API endpoint not to the app universal link like https://api.example.com/redirect not the app://redirect
For now I am able to use WKWebView to detect that redirect was done by comparing urls and if match to close WebView.
The problem is that in this approach I cannot use google login (WebView is rejected) during this flow.
I tried to use ASWebAuthenticationSession but after redirect I am not able to detect that this redirect was done (as it hits API not the app) to close AuthenticationSession view automatically.
Is it possible at all in such case or the only way to close AS is to redirect to app universal link app:// not to the https://?
Any help really appreciated
You need to use the ASWebAuthenticationSession window with the AppAuth pattern, as described in RFC8252. This is a form of the system browser so will not be blocked by providers such as Sign in with Google.
This form of login can be used with either custom URI schemes, such as com.mycompany.myapp:/callback or with HTTPS callback URIs that require iOS universal links to be configured. You are then notified when login conpletes, or is cancelled, or fails.
A sample app of mine does logins with universal links via this code, which adapts AppAuth classes to more of a [Swift async await style. If you are new to AppAuth libraries, see also my introductory blog post.
func login(viewController: UIViewController) async throws {
try await self.authenticator.getMetadata()
try await MainActor.run {
try self.authenticator.startLoginRedirect(viewController: viewController)
}
let response = try await self.authenticator.handleLoginResponse()
try await self.authenticator.finishLogin(authResponse: response)
}

Safari error on login Microsoft account with oauth2

I have a a problem on a Nativescript 5.1.0 project with Angular 4, I use the API nativescript-oauth2, and it works fine for Facebook and Google, but when I try to Login into Microsoft it does not do very well.
I can enter the e-mail account and password, even the permission screen is shown, but in this one when I press YES it crashes.
The problem is because of the property redirect uri (urn:ietf:wg:oauth:2.0:oob) for the Microsoft configuration, when Safari receives the redirect uri, Safari crashes.
I read that can be solved with a delegate, but it already exists in the nativescript-oauth2.
And the android browser does not show the error but it does nothing.
Help me please!!
With Microsoft oAuth, it tries to open your app with an URL scheme. You might want to setup URL schemes in your app like it's showcased in demo app for Provider, iOS & Android

Oauth 2.0 facebook provider in Chrome package app. Redirect-url issue

I'm dealing with Oauth 2.0 facebook provider in Chrome package app using chrome.identity namespace and the method launchWebAuthFlow (https://developer.chrome.com/apps/identity#method-launchWebAuthFlow) .
My url of the launchWebAuthFlow method is "https: //www.facebook.com/dialog/oauth?client_id={app-id}&redirect_uri={redirect-uri}"
Reading the docs of this api, the redirect-uri must to be like this https ://abcdefghijklmnopqrstuvwxyzabcdef.chromiumapp.org/provider_cb where abcdefghijklmnopqrstuvwxyzabcdef is the ID of the chrome app. (https://developer.chrome.com/apps/app_identity)
When i run this code, facebook shows me a popup, "configuration of app doesn't allow the given url" instead the facebook login form. Facebook has to be blocking the redirect-uri but i don't know how to proceed.
Thanks in advance.
I answer myself.
It's like Xan said, has to be on the configuration of the Facebook app and that is it. The url https://abcdefghijklmnopqrstuvwxyzabcdef.chromiumapp.org/provider_cb has to be written in the 'Site Url' in the Facebook app form configuration.

Heroku as Facebook Canvas app: page ok on heroku, page doesn't exist on facebook app

Nothing fancy here, but I'm on it since one hour with no success.
I'm trying to load my RoR root page welcome#index inside a Facebook canvas app.
My welcome#index is empty (http://sitlux-contact.herokuapp.com) and work well when url is copy-pasted in search bar
On Facebook, I set an "App on facebook" app with theses settings:
Canvas url: http://sitlux-contact.herokuapp.com/ (note that the last "/" is requested by Facebook)
Canvas secure url: https://sitlux-contact.herokuapp.com/
This is my Facebook canvas page url:
https://apps.facebook.com/sitlux-contact
Heroku page is working perfectly when direct url is used in browser, but generate a "The page you were looking for doesn't exist." when I'm trying to load it inside the canvas app.
Any clue on this would be very helpful. Thank you in advance. KR
Debugging your facebook app page using Firebug net panel saw that facebook is requesting your app url with a POST request. I've received the same response using this curl command
curl --data "fake_param=fake_value" https://sitlux-contact.herokuapp.com/
I think you should handle POST response to clients.

Resources