4

I am taking a look at the default OAuth implementation that comes with asp.net mvc 4. It definitely is impressive, as all i had to do was add this line in AuthConfig.cs:

OAuthWebSecurity.RegisterLinkedInClient("_key_", "_secret_");

enabling above, did offer up the LinkedIn link to login. I was prompted for password once, but after entering it i got:

"Login Failure. Unsuccessful login with service."

, and have been getting this ever since w/out ever being prompted for password again.

It is not clear to me if this is due to initial bad credentials i entered, or something with the way i set up the key.

Also, i don't see the actual controller code anywhere within my app, so even if my login worked, it is not clear how i could obtain information from linked in.. i.e. history.

it is nice how easy this integration was, but I am leaning towards a more manual implementation of this?

however i can't help but wonder that above implementation probably also works.

UPDATE

i've traced the problem to be this call:

public ActionResult ExternalLogin(string provider, string returnUrl) {
    return new ExternalLoginResult(provider, Url.Action("ExternalLoginCallback", new { ReturnUrl = returnUrl }));
}

callback comes back with "401 Unauthorized".. even though the credentials are correct. from what i can gather in other posts, this may be due to incorrectly formed headers by OAuth library?

4 Answers 4

7

I had the same problem and it would appear that this is a bug.

See "Paul Roa" comments on this post:

http://blogs.msdn.com/b/webdev/archive/2012/08/15/oauth-openid-support-for-webforms-mvc-and-webpages.aspx?PageIndex=2

and then his solution (which works for me), here:

http://blog.mrroa.com/post/30454808112/asp-net-custom-linkedin-oauth-provider

Sign up to request clarification or add additional context in comments.

Comments

2

I had the same problem.

I updated all OAuth packages using NuGet, and now everything works fine.

Comments

2

It appears that OAuth was shipped in vs2012 with a bug. Here is the tutorial that explains why the error. http://www.devcurry.com/2013/01/connect-to-linkedin-using-oauth-in.html

I had to also update Nuget in order to get the DotNetOpenAuth.Core package to update. Once updated, it worked as expected. Hope someone finds this useful.

Comments

1

Sounds like bad credentials, it worked fine for me. Sadly the template does not allow changing passwords or deleting accounts, but you could remove the LinkedIn connection and then create a new account from your LinkedIn login to try again.

As for the implementation they use and extending it I haven't gotten around to looking into that yet. Plan to do so though since I'm also thinking about using it if it looks good.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.