Doodle.com API / OAuth2Client with MVC4 & C# - asp.net-mvc

im trying to implement a custom OAuth2Client for my ASP MVC4 Application so that the users can login with their doodle.com Account.
Based on this Code, i tried to give it a shot. Unfortunately, im always getting an error 400 "bad request". Any ideas on this? My Login-Urls look like this:
http://doodle.com/api1/oauth/requesttoken?oauth_callback=http%3A%2F%2Flocalhost%3A49705%2FAccount%2FExternalLoginCallback%3F__provider__%3DDoodle%26__sid__%3D81daa197e305495b916b0f347fadf1c0&oauth_consumer_key=MYKEY&oauth_nonce=557897134&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1384429618&oauth_signature=NODC1gMPquzNx9TVg2wVoaZqjlk%3d
You can find my gist here: https://gist.github.com/davidroyal/7469100

I got it working on my own. Backdraft: You have to authorize your application on every login. But for connecting your doodle.com account with an existing account in your application, its just perfect.
Please find the experimental implementation under:
https://gist.github.com/davidroyal/7469100

Related

SignInManager.ExternalSignInAsync returns SignInStatus.Failure

In my mixed MVC and WebAPI project, I tried to OAuth users via google, it returns SignInStatus as Failure always. I don't know why and also I wonder even with failure status, the template code (from Microsoft) in ExternalLoginCallback() method for SignInStatus.Failure status is redirecting to a page with "Succesfully authenticated message".
I am trying this in a new test project and Owin libraries are latest.
I just tried running the same code after sometime, it worked. Looks like google API needs sometime to update.

Not able to access my MVC 5 web application after adding MS Identity

I created my app using a template. After that i managed to connect it with an existing database. Then i tried to add Identity so that i will be able to authorise and authenticate users of the application. I tried to do that following the instructions of "shyamal parikh" in this post Adding ASP.NET MVC5 Identity Authentication to an existing project
My problem is that now i get a 401 error unless i got to solution explorer (in VS) and disable the windows authentication. But when i do that all the users have unrestricted access to the whole application.
I assume that the problem has to do with that solution that i performed but i cant comment directly there.
Can anyone give me a hint as to what i might be doing wrong?
Do you have windows authentication installed on your computer? Maybe adding that might help. Here are the instructions-
https://www.iis.net/configreference/system.webserver/security/authentication/windowsauthentication/providers/add
Also look at your event viewer, you might have some hints there.

Microsoft Sign-In for ASP.NET MVC 5 web role

I have created Azure cloud service and in this cloud service I have a web role serving as a MVC web application. I followed this tutorial to use Microsoft account as the external authentication. When I try with the localhost it works perfectly. However, after I deploy the cloud service, I changed the redirect URL to the site url which is http://109e199cf5864b50ab25ac839f8c151d.cloudapp.net/. But this doesn't work. I can reach the authorization part, but after I login with the Microsoft account I got Error Message: An error occurred while processing your request. What should I do to make it work?
UPDATE:
I tried to remove the [Authorize] tag in my controller so that I don't need to login to see the view. After I deployed again, I got the Error Message directly!!
I didn't login at all! I checked the code this Error Message is actually the Error view from the template in the Shared folder. But there is no change of the code to return me this Error view! What I am missing with the deployment here?
In the comments of the blog post you referenced, the author (Ben Day) said there was an update to the redirect URI.
With the latest version of the ASP.NET Identity code, the redirect uri is a different value. So on account.live.com, the redirect url value for your app is now going to be “http://myapp-url/signin-microsoft”.
You may want to check that you have the correct values here.

Google Auth does not work in template asp.net mvc project

So I have VS 2013 update 4 and I created ASP.NET MVC application from template and configured Google authentication by using UseGoogleAuthentication method and passing client ID and secret. But for some reason once I click 'Accept' button google page I'm redirected to the page I expect but there is an error 500 in the browser console and nothing on the page itself.
I read a lot of articles and enabled all required APIs in Google Developer console. But nothing seems to work for me.
Also I have another custom authentication middleware that worked just fine before and stopped working once I enabled Google. I use nuget package version 3.0.1.
If I disable my custom auth middleware Google still does not work.
Please advise.
OK, here's why should probably stay with default values. So default redirect URL is /signin-google built-in to Google middleware. And because my URL is /Account/ExternalLoginCallback I thought it was a good idea to set it when configuring GoogleOAuth2AuthenticationOptions.
Once removed CallbackPath = new PathString("Account/ExternalLoginCallback") from configuration it just worked.

Steam OpenId in MVC application

I have never done an openid application before. I did see that MVC 5 has some built in oauth sign ins. I was able to get these to work no problem, as they are already built.
But I am completely unsure how to get the steam openid to work in MVC. Does anyone have some sample code of there MVC Steam OpendID stuff? Or does anyone know a good tutorial for this?
Go to Tools > Library Package Manager > Package Manager Console and type:
Install-Package Owin.Security.Providers
Open your App_Start\Startup.Auth.cs, and add:
using Owin.Security.Providers.Steam;
Then, in the ConfigureAuth method, add:
app.UseSteamAuthentication("your API key");
You can get an API key from http://steamcommunity.com/dev.
A "Steam" button should be added to your login page.
Here is an excellent tutorial on how to integrate openid with ASP.NET MVC, and it do have working code, and instructions. Please have a look and get going.
http://weblogs.asp.net/haithamkhedre/archive/2011/03/13/openid-authentication-with-asp-net-mvc3-dotnetopenauth-and-openid-selector.aspx
Hope this helps.

Resources