GithubHelp home page GithubHelp logo

Comments (9)

MossP avatar MossP commented on May 28, 2024

Current code from the readme

var FBSDKLogin = require('react-native-fbsdklogin');
var {
  FBSDKLoginManager,
} = FBSDKLogin;

// ...

// Attempt a login using the native login dialog asking for default permissions.
FBSDKLoginManager.setLoginBehavior(GlobalStore.getItem('behavior', 'native'));
FBSDKLoginManager.logInWithReadPermissions([], (error, result) => {
  if (error) {
    alert('Error logging in.');
  } else {
    if (result.isCanceled) {
      alert('Login cancelled.');
    } else {
      alert('Logged in.');
    }
  }
});

// ...

from react-native-fbsdk.

swiese avatar swiese commented on May 28, 2024

The underlying Facebook SDK for iOS chooses the best login method available. By specifying login behavior native you are simply telling the sdk that it can login through the native app.

See
https://github.com/facebook/facebook-ios-sdk/blob/master/FBSDKLoginKit/FBSDKLoginKit/FBSDKLoginManager.h#L78

for more details on why this the behavior
http://stackoverflow.com/questions/32375916/safari-web-view-opening-when-logging-to-fb-through-ios-9

from react-native-fbsdk.

MossP avatar MossP commented on May 28, 2024

Ah, thanks for the info.. This is a shame as the login dialog now gets hidden underneath other modals easily.

from react-native-fbsdk.

swiese avatar swiese commented on May 28, 2024

MossP it should open in safari and switch to that app and not a web view. Are you seeing it open a web view.

You might want to try just leaving the behavior as the default and it should on ios 9+ open the safari view controller which will fast app switch to safari and on older devices use the facebook app if installed else open a webview.

from react-native-fbsdk.

MossP avatar MossP commented on May 28, 2024

Yeah, It's opening in a modal for me, even with 'default' behaviour and doesn't fast switch anywhere. It just gets lost, buried in the app. I only get to see it when I close windows in the app and then I see several opened modals all grouped together.

I'll look again to see if it's the security enhancements of iOS9 that are causing it if that's what it's supposed to do. Thanks again, @swiese.

from react-native-fbsdk.

MossP avatar MossP commented on May 28, 2024

I checked the security settings. All are ok. The modal just insists on opening and sitting out of view until I close everything. Looks like there are quite a few devs put out by this change. It's a real shame. I might have to look at an alternative approach to logging users in. Thanks again.

from react-native-fbsdk.

mikelambert avatar mikelambert commented on May 28, 2024

Did you ever figure this out? I'm calling LoginManager.logInWithReadPermissions(), but my login dialog is hidden, though it blocks my await/promise to return, so it's open underneath there somewhere...

But using a FBLoginButton, it appears to pop up a login modal just fine. My best guess is that this might be because the manual logInWithReadPermissions implementation passes an fromViewController:nil, whereas the FBLoginButton calls fromViewController:[FBSDKInternalUtility viewControllerforView:self]?

Unfortunately, sometimes I need to re-request permissions automatically (ie a completely expired access token, or needing to upgrade them to the latest set of permissions I use), and I'd rather not present them with a login button. (At least, I never did it in my iOS app using FB SDK...)

from react-native-fbsdk.

MossP avatar MossP commented on May 28, 2024

Unfortunately not. I stayed with an old version (of RN and FBSDK) for that particular project and changed my flow in future apps to avoid the situation.

from react-native-fbsdk.

mikelambert avatar mikelambert commented on May 28, 2024

Okay, so my guess was wrong, as it seems to be timing-related. But I see this issue is closed, so I've opened a new one to track my issue.

from react-native-fbsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.