I have an API which I use on mobile devices. So I wrote some code for users to Authenticate through Facebook using OAuthWebSecurity. After doing some decoupling and copying code from AccountController and this is what I have:
AuthenticationResult
result = OAuthWebSecurity.VerifyAuthentication(facebookReturnUri);
I pass in the correct valid facebookRerurnUri and the result is always "NULL". There is no error attached
to it or any other useful information.
I was hoping if someone can please provide some insight on what might be going on here.
I'm not sure the result can be null -- I'm looking thru the code and it always returns a valid result with the IsSuccessful to false if there is a problem.
Is there a way to figure out why would it be false ? As there is no error which is returned. I know the passed Url is correct because I can manually extract the token and use it, that works.
I think those names are hard-coded somewhere, so I bet if you tried "Facebook" you might get lucky. Otherwise dig thru the code a bit and find where they populate that list and where they get the keys from.
thukral
0 Points
7 Posts
OAuthWebSecurity.VerifyAuthentication returning null
Dec 18, 2012 03:32 AM|LINK
Hi,
I have an API which I use on mobile devices. So I wrote some code for users to Authenticate through Facebook using OAuthWebSecurity. After doing some decoupling and copying code from AccountController and this is what I have:
AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(facebookReturnUri);
I pass in the correct valid facebookRerurnUri and the result is always "NULL". There is no error attached to it or any other useful information.
I was hoping if someone can please provide some insight on what might be going on here.
Thanks,
Harsimrat
BrockAllen
All-Star
27502 Points
4895 Posts
MVP
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 18, 2012 02:48 PM|LINK
I'm not sure the result can be null -- I'm looking thru the code and it always returns a valid result with the IsSuccessful to false if there is a problem.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
thukral
0 Points
7 Posts
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 18, 2012 04:31 PM|LINK
Is there a way to figure out why would it be false ? As there is no error which is returned. I know the passed Url is correct because I can manually extract the token and use it, that works.
BrockAllen
All-Star
27502 Points
4895 Posts
MVP
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 18, 2012 04:42 PM|LINK
Well, since all that code is available on codeplex, you could always download it and debug into it :)
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
thukral
0 Points
7 Posts
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 18, 2012 05:12 PM|LINK
Do you happen to know what is the project name ? I have tried looking for it as the OAuthWebSecurity class sits in Microsoft.Web.WebPages.OAuth.
BrockAllen
All-Star
27502 Points
4895 Posts
MVP
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 18, 2012 05:32 PM|LINK
It's in Microsoft.Web.WebPages.OAuth:
http://aspnetwebstack.codeplex.com/SourceControl/changeset/view/d6c669701bbb#src/Microsoft.Web.WebPages.OAuth/OAuthWebSecurity.cs
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/
thukral
0 Points
7 Posts
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 19, 2012 04:43 AM|LINK
After doing further debugging, seems like the ProviderName is null and it's not available in context.
string providerName = OpenAuthSecurityManager.GetProviderName(context);
I'm not using this in Forms application but exposing SimpleMembershipProvider as a service, so is there a way to set the correct provider.
BrockAllen
All-Star
27502 Points
4895 Posts
MVP
Re: OAuthWebSecurity.VerifyAuthentication returning null
Dec 19, 2012 05:05 AM|LINK
I think those names are hard-coded somewhere, so I bet if you tried "Facebook" you might get lucky. Otherwise dig thru the code a bit and find where they populate that list and where they get the keys from.
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/