check for already registered with this app in facebook login in ios

Sneha

I am integrating FB in my app for login & signup purpose in my iOS app..

While i signup with fb from app, i want to know the user has already registered with fb for that app or not,

if he is already registered then i want to perform login actions

otherwise signup actions..!!

- (void)  loginButton:(FBSDKLoginButton *)loginButton
    didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result
                error:(NSError *)error{

    FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc]
                                  initWithGraphPath:[NSString stringWithFormat:@"/%@",result.token.userID]
                                  parameters:@{ @"fields" : @"id, name, email, first_name, hometown, last_name, location" }
                                  HTTPMethod:@"GET"];
    [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
        [self handleRequestCompletionWithResult:result error:error];
    }];
}


- (void)handleRequestCompletionWithResult:(id)result error:(NSError *)error
    {
    NSString *title = nil;
    NSString *message = nil;
    if (error) {
        title = @"Graph Request Fail";
        message = [NSString stringWithFormat:@"Graph API request failed with error:\n %@", error];
    } else {
        title = @"Graph Request Success";
        message = [NSString stringWithFormat:@"Graph API request success with result:\n %@", result];
        if(already registered user) {
             //perform login for my app
        } else  {
             //perform signup action for my app
        }
    }
    NSLog(@"%@",message);
}

Is there any way to achieve it?

Tejas K

I did integrate the FBSDK in one of my apps recently, and this is what i did to check if the user is already authorised.

if ([FBSDKAccessToken currentAccessToken]) {
//perform login for your app
}
else {
// perform signup action for your app
}

Hope this helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to know user has already done Facebook login at iOS app

From Dev

Facebook login in iOS app

From Dev

iOS - Facebook Login Check Login Status

From Dev

iOS: Login to Facebook through app

From Dev

IOS Facebook login through the app

From Dev

Firebase check email registered if Login via facebook and google

From Dev

iOS: Check if user is already logged in using Facebook?

From Dev

how to check if already logged in Facebook in ios?

From Dev

iOS : Login with Facebook and open Native Facebook app

From Dev

Parse Facebook Login: User return null & Callback already registered for <facebook> error

From Dev

Check if an account is already registered in AccountManager

From Dev

Check if a method is already registered to an event

From Dev

Check if a method is already registered to an event

From Dev

Error when adding Facebook login to iOS app

From Dev

Facebook Login with another account from iOS app

From Dev

object cannot be nil for Facebook login in IOS app

From Dev

Error when adding Facebook login to iOS app

From Dev

Facebook/Android - how to check whether the user has already been registered, and now just log them in

From Dev

How do I use Facebook Login via Facebook App for iOS

From Dev

How do I use Facebook Login via Facebook App for iOS

From Dev

Swift ios facebook login crashes app if user cancel login

From Dev

The developers of this app have not set up this app properly for Facebook Login in iOS?

From Dev

Twitter Digits : how to check if the user is already registered

From Dev

How to check if user is already registered in firebase?

From Dev

iOS Parse SDK: How to check if login is from Facebook or Twitter?

From Dev

Swift Facebook Login AppID Not Registered as a URL Scheme

From Dev

iOS in app purchase. How to check if purchase already bought?

From Dev

Android check contacts if they are registered in an app

From Dev

Facebook login in IOS works on emulator but not on device with native app installed

Related Related

  1. 1

    How to know user has already done Facebook login at iOS app

  2. 2

    Facebook login in iOS app

  3. 3

    iOS - Facebook Login Check Login Status

  4. 4

    iOS: Login to Facebook through app

  5. 5

    IOS Facebook login through the app

  6. 6

    Firebase check email registered if Login via facebook and google

  7. 7

    iOS: Check if user is already logged in using Facebook?

  8. 8

    how to check if already logged in Facebook in ios?

  9. 9

    iOS : Login with Facebook and open Native Facebook app

  10. 10

    Parse Facebook Login: User return null & Callback already registered for <facebook> error

  11. 11

    Check if an account is already registered in AccountManager

  12. 12

    Check if a method is already registered to an event

  13. 13

    Check if a method is already registered to an event

  14. 14

    Error when adding Facebook login to iOS app

  15. 15

    Facebook Login with another account from iOS app

  16. 16

    object cannot be nil for Facebook login in IOS app

  17. 17

    Error when adding Facebook login to iOS app

  18. 18

    Facebook/Android - how to check whether the user has already been registered, and now just log them in

  19. 19

    How do I use Facebook Login via Facebook App for iOS

  20. 20

    How do I use Facebook Login via Facebook App for iOS

  21. 21

    Swift ios facebook login crashes app if user cancel login

  22. 22

    The developers of this app have not set up this app properly for Facebook Login in iOS?

  23. 23

    Twitter Digits : how to check if the user is already registered

  24. 24

    How to check if user is already registered in firebase?

  25. 25

    iOS Parse SDK: How to check if login is from Facebook or Twitter?

  26. 26

    Swift Facebook Login AppID Not Registered as a URL Scheme

  27. 27

    iOS in app purchase. How to check if purchase already bought?

  28. 28

    Android check contacts if they are registered in an app

  29. 29

    Facebook login in IOS works on emulator but not on device with native app installed

HotTag

Archive