2016-12-02 91 views
4

我目前正在爲我的Reach Native應用程序設置Facebook身份驗證。在react-native-fbsdk安裝程序的常見問題後,現在Facebook應用程序事件工作和LoginManager加載。FB SDK錯誤:登錄失敗(react-native)

我的問題:授權後LoginManager重定向我回應用程序,然後顯示我的錯誤:

Login Failed

我用很標準的LoginManager實現:

const FBSDK = require('react-native-fbsdk'); 
const { 
    LoginManager, 
    AccessToken, 
} = FBSDK; 


export default class FacebookAuth extends Component { 

    facebook(){ 
    LoginManager.logInWithReadPermissions(['public_profile', 'email']).then(
    function(result) { 
    if (result.isCancelled) { 
     alert('Login cancelled'); 
    } else { 
     alert('Login success with permissions: ' 
     +result.grantedPermissions.toString()); 
    } 
    }, 
    function(error) { 
    alert('Login fail with error: ' + error); 
    } 
); 

你有什麼指針給我?

我已經檢查:在Info.plist中

  • 的iOS捆綁ID

    • FB應用信息在Facebook應用
    • 客戶端的OAuth設置
    • FBSDK LoginButton(同樣的錯誤)

    我正在運行的版本:iOS 10 & react-native 0.38.0。

    謝謝!

  • 回答

    7

    Error when login with Facebook SDK — React Native

    The problem was that Facebook SDK was still keeping the previous session token, and when I was trying to login again I was getting this error, to solve this problem all I had to do was to call the logOut method from the LoginManager.

    嘗試將此LoginManager.logInWithReadPermissions...

    LoginManager.logOut();