0

It seems as though the solution cited here:

No longer works. I have attempted both that and reconfiguring my Facebook app by resetting the secret, reconfiguring Parse with my new app credentials, and resetting xCode for a new simulator environment and all have failed. I continue to get old authentication data when the following function is called:

//sign up into parse db
             Parse.FacebookUtils.logIn(authData, {
                  success: (user) => {
                    if (user.existed()) {
                      // login: nothing to do
                      console.log('User Already Logged In');
                      that.setState({loadingCurrentUser: false});
                      that.props.navigator.immediatelyResetRouteStack([{ name: 'home'}]);
                    } else {
                      // signup: update user data, e.g. email
                      console.log('getting user additional information');
                      var data = user.get('authData').facebook;
                      var api = 'https://graph.facebook.com/v2.3/'+data.id+'?fields=name,email&access_token='+data.access_token;

                      var fetchProfile = new FBSDKGraphRequest((error, result) => {
                        if (error) {
                          // TODO: error
                          this.setState({loadingCurrentUser: false});
                        } else {
                          console.log(result);
                          var name = responseData.name;
                          var email = responseData.email;

                          // FIXME: https://github.com/ParsePlatform/ParseReact/issues/45
                          var userId = {
                            className: '_User',
                            objectId: user.id
                          };

                          ParseReact.Mutation.Set(userId, {
                            username: email,
                            email: email,
                            name: name
                          }).dispatch();

                          that.setState({loadingCurrentUser: false});
                          that.props.navigator.immediatelyResetRouteStack([{ name: 'onboarding'}]);
                        }
                      }, '/me?fields=name,email');
                      // FIXME https://github.com/facebook/react-native-fbsdk/issues/20
                      // fetchProfile.start();
                      FBSDKGraphRequestManager.batchRequests([fetchProfile], function() {}, 10)
                    }
                  },
                  error: (user, error) => {
                    console.log('Error', error);
                    console.log(user.token);
                    switch (error.code) {
                      case Parse.Error.INVALID_SESSION_TOKEN:
                        Parse.User.logOut().then(() => {
                          this.onFacebookLogin(token);
                        });
                        break;
                      default:
                        // TODO: error
                    }
                    that.setState({loadingCurrentUser: false});
                    that.setState({errorMessage: error.message});
                  }
                });

I am not sure how to proceed. Any help with error 251 and the most recent version of React Native (iOS)?

Community
  • 1
  • 1
Robert Tomas G IV
  • 2,315
  • 4
  • 18
  • 41
  • 2
    http://blog.parse.com/announcements/announcing-new-enhanced-sessions/ you may want to review that. I dont use ios or react... but your situation sorta sounds like the server side remove a session and the client is left with orphaned token value , that , when used will throw 'token-errors' ... usually just do a new logon when the token error arises and the new login ( as oppposed to trying to reuse a stale token ) just works – Robert Rowntree Dec 08 '15 at 22:13
  • thanks @RobertRowntree I'll take a look - the situation sounds exactly like what you described – Robert Tomas G IV Dec 09 '15 at 03:23

0 Answers0