37

Using the Facebook iOS SDK I have received an access_token for the user of my iOS application which allows me to view their basic profile information. I would like to use that token to register & login users against my existing web application.

I don't want the user to navigate to the account/ExternalLogins URL and be redirected from there in a WebView as at this point I already have the access token that provides. What I don't understand is how I can make use of the Acccount/RegisterExternal or Account/AddExternalLogin methods and provide them with this existing token and a username/email to register a new user. All of my attempts have been met with 400 or 500 errors.

I've checked a lot of stack overflow answers and blog posts but they seem to roll-your-own or modify existing methods in the AccountController. But I don't see why doing either of these things are necessary when it looks like everything is already there for you. I'm just not sure how I can make use of it!

Any help would be greatly appreciated.

Edit: I ended up using this custom solution by codetrix. It's not what I originally wanted but it was simple to include and works so far. If anyone is able to answer the original question then please do.

timiTao
  • 1,417
  • 3
  • 20
  • 34
bean
  • 1,091
  • 1
  • 12
  • 23

1 Answers1

1

If you already have the token and can view the information, use an instance of the UserManager to push that information to. That's essential what your codetrix solution is doing, but you can do the same.

The endpoints your referencing just have those setup already, so view that code to see how it's invoking the UserManager and work the same functionality out where you need it.

Greg
  • 31
  • 7