I'm writing a simple web application in MVC 4, and I want to OAuth with Trello so that I can ask a user to log-in with their trello details and then see some of their cards.
Can anyone provide information about creating a custom oauth provider to support non-out of the box oauth providers? From what I can see, I think I need to create a custom Oauth provider (subclass IAuthenticationClient
and use that) - is that right?
OAuth 2.0 is a protocol that allows a user to grant limited access to their resources on one site, to another site, without having to expose their credentials. Auth0 is an organisation, who manages Universal Identity Platform for web, mobile and IoT can handle any of them — B2C, B2B, B2E, or a combination.
When you create an MVC 4 web application with the Internet Application template, the project is created with a file named AuthConfig. cs in the App_Start folder. The AuthConfig file contains code to register clients for external authentication providers.
OAuth is an open standard for authorization. OAuth provides client applications a "secure delegated access" to server resources on behalf of a resource owner. It specifies a process for resource owners to authorize third-party access to their server resources without sharing their credentials (from the Wikipedia).
OAuth 2.0, which stands for “Open Authorization”, is a standard designed to allow a website or application to access resources hosted by other web apps on behalf of a user.
Okay, I spent the 11 hours since my comment writing a custom oAuth class for SO. Tomorrow I get to do one of sales force. I'm not excited.
Here's what I did:
Create a DataContract class for your expected Json/Xml. I went ahead and implemented everything that SO returns, but if you're only doing authorization you can probably cut it down to an ID and DisplayName.
Create a class that extends OAuth2Client from DotNetOpenAuth.AspNet.Clients. Use the DotNetOpenAuth GitHub page for examples. This is the longest, and most painful step, especially if your json serialization is rusty.
Open up /App_Start/AuthConfig.cs
and enter OAuthWebSecurity.RegisterClient(new YourClass(Your, Initalization, Params), "The Name You Want to Show Up On Your oAuth Login Button", ExtraDataIfYouNeedIt;
somewhere in the RegisterAuth()
section. I haven't established what the ExtraData param is for, but I didn't need it in my case. Hopefully you won't need it in yours.
Edit: Updated github link.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With