Facebook redirect_uri configured on ios url scheme

I am starting to explore how to work with Facebook programmatically.

I set the URL scheme in my application so that I can open it from the browser using "myappopenup: //".

Then I created a Facebook application. I copied the AppId and tried to do this:

let url = NSURL(string: "https://www.facebook.com/dialog/oauth?client_id={MY_APP_ID_WAS_HERE}&redirect_uri=myappopenup://fbcallback")
UIApplication.sharedApplication().openURL(url!)

After running this code, the simulator opened safari (first I tried with SFSafariViewController). but all i saw was:

enter image description here

So, I would like to know: is it possible to redirect oauth from Facebook to my application?

+4
source share
4 answers

Yes it is possible. Here you need redirect_uri :

  https://graph.facebook.com/oauth/authorize
  ?response_type=token
  &client_id='+'1247676148624015
  &redirect_uri=fb1247676148624015://authorize

, facebook :

Setting up applications for Facebook

, URL :

enter image description here

- , . .

+7

Alex Paterson . URL- redirect_uri Facebook. URI OAuth URL- :

https://graph.facebook.com/oauth/authorize?
response_type=token&
client_id=12345678910&
redirect_uri=fb12345678910://authorize
+1

, , , , Facebook - , , FBSDK facebook.

, someapp://authorize, , , -.

native ( . , obj-C ), react-native-fbsdk, LoginButton AccessToken, :

          <LoginButton
           readPermissions={["email", "public_profile"]}
           onLoginFinished={
            (error, result) => {
             if (error) {
              alert("Login failed with error: " + result.error);
             } else if (result.isCancelled) {
              alert("Login was cancelled");
             } else {
              AccessToken.getCurrentAccessToken().then((data) => {
                  const token = data.accessToken;
                  // send the token to your backend
                }
              )
              alert("Login was successful with permissions: " + result.grantedPermissions)
            }
          }
        }
        onLogoutFinished={() => alert("User logged out")}
      />
0

I contacted Facebook support and confirmed that it is not supported:

Thank you for coming in contact. We will make the message more understandable, but we do not support custom URI schemes as valid redirect URIs. To log in to your own application without opening a browser, use the official SDKs ( https://github.com/xamarin/FacebookComponents , what are you looking for?).

They answered in less than 12 hours, which was at least impressive.

0
source

All Articles