locked
Working with Facebook external data on Web Api 2 (VS 2013 Web Api 2) RRS feed

  • Question

  • User-2002448428 posted

    HI, im currently working on a external login (with facebook), and im using the default oAuth method(RegisterExternal method). At the beginning i had the issue that my var info was null, i solved it with the following solution : http://forums.asp.net/t/1989780.aspx?Web+API+2+OAuth+GetExternalLoginInfoAsync+always+return+null

     // POST api/Account/RegisterExternal
            [OverrideAuthentication]
            [HostAuthentication(DefaultAuthenticationTypes.ExternalBearer)]
            [Route("RegisterExternal")]
            public async Task<IHttpActionResult> RegisterExternal(RegisterExternalBindingModel model)
            {
                if (!ModelState.IsValid)
                {
                    return BadRequest(ModelState);
                }
    
    
                var info = await AuthenticationManager_GetExternalLoginInfoAsync_WithExternalBearer();
    
                if (info == null)
                {
                    return InternalServerError();
                }
                
                var user = new User() { UserName = model.Email, Email = model.Email };
    

    Now everything works, but im having the problem that i cant retrieve any data of the info variable, just the user name, because the email and the other stuff contains null info. I dont want to do a login in which you have to enter manually your email. Like most web sites, i'd like to ask the user for permissions, and login with just 2 clicks. Do i have to work with facebook SDK as well? or oAuth is enough to do this?

    Thanks 

    PD: My english is bad


     

    Thursday, September 17, 2015 1:14 PM

Answers