Teemu Tapanila bio photo

Teemu Tapanila

CTO of Mallow

Email Twitter LinkedIn Github

Sometimes you might need special permissions right from start on your web application. Default MVC 4 OAuth clients only ask basic permissions and you can’t change that behavior unless you create your own OAuth client. I did that for Facebook and later on will continue with other providers when needed

You can find the source code from here

Here’s the guide how to use it:

  1. Create new MVC 4 web application CreateProjectMVC4_2
  2. Open package manager console Package Manager Console
  3. Write "Install-Package MVCScopedClient" Install-package MVCScopedClient
  4. Open authconfig.cs AuthConfig.cs
  5. Write Using MVCScopedClients;
  6. Add this line to RegisterAuth() function OAuthWebSecurity.RegisterClient(new FacebookScopedClient("API-key", "API-secret", "PermissionScope"), "Facebook", new Dictionary<string, object>()); AuthConfig Completed
  7. Done