Skip to content

jhoerr/box-csharp-sdk-v2.sample.oauth

Repository files navigation

Box C# SDK (API v2) OAuth2 Sample (MVC)

An MVC-based demonstration for Box's OAuth implementation in the v2 API. This is based on the Box C# SDK (API v2).

License

Creative Commons Attribution 3.0 Unported License

NuGet

This project is available as a NuGet package.

Usage

You can run this project as-is or integrate it into an existing MVC application with the NuGet package.

Part of the OAuth2 workflow involves an HTTPS redirect from Box's site to the one you'll be running here. An HTTPS URL for your site must be pre-registered with Box in order for everything to work. (This pre-registration is done in order to prevent rogue redirects.) Visual Studio doesn't enable SSL by default, so there are a few manual steps required to make it all work.

Enable SSL connections in your project

  1. In the Solution Explorer, left-click on the MVC project to select it.
  2. Press F4 to bring up the project's Properties.
  3. Change 'SSL Enabled' from False to True. The SSL URL field should be automatically populated.
  4. Copy the SSL URL to the clipboard.

Configure your project to start with the SSL URL

  1. Now right-click on the project name and select 'Properties'
  2. Click the 'Web' tab
  3. In the 'Servers' section find the text box labeled 'Project Url'
  4. Paste the SSL URL into this text box and save the changes.

Configure your Box application to redirect to the SSL URL

  1. Browse to http://developers.box.com
  2. Click on "My Box Apps" on the upper right; log in.1
  3. Edit the application that you want to work with.
  4. Under 'OAuth2 Parameters' locate the 'redirect_uri' field.
  5. Paste the SSL URL into this field. Save your changes.

This configures your app to use SSL and tells Box to redirect you back to this HTTPS site after you've authenticated and agreed to let your application access your Box data.

About

An MVC-based sample the demonstrate Box's v2 OAuth implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published