Skip to content

Commit e2fdd2b

Browse files
committed
Create README.md
1 parent a48dd1a commit e2fdd2b

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
This sample .NET MVC web app shows how to use the OAuth 2.0 capabilities in Visual Studio Online to prompt users to authorize your app and to acquire an access token and refresh token to access their Visual Studio Online resources.
2+
3+
To learn more about OAuth in Visual Studio Online, see [Authorize access with OAuth 2.0](http://www.visualstudio.com/integrate/get-started/get-started-auth-oauth2-vsi)
4+
5+
###Pre-requisities###
6+
7+
These instructions assume you will be deploying this sample app to an Azure web site. To learn more and to get started, visit [Get started with Azure Web Sites and ASP.NET](http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-get-started).
8+
9+
###Setup###
10+
1. Register an OAuth client app on Visual Studio Online (https://app.vssps.visualstudio.com/app/register) (note: the callback URL should be https://yoursite.azurewebsites.net/oauth/callback, where "yoursite" is the name of your Azure web site)
11+
2. Clone this repository
12+
3. Open the solution (VSOClientOAuthSample.sln) in Visual Studio 2013 (or later)
13+
4. Update the following settings in web.config to match the values in the app you just registered:
14+
* App ID
15+
* App Secret
16+
* Scope (space separated)
17+
* Callback URL
18+
5. Build (this will trigger a NuGet package restore, which will pull in all dependencies of the project)
19+
6. Deploy the app.
20+
21+
###Run###
22+
1. Navigate to the app (https://yoursite.azurewebsites.net)
23+
2. Confirm your App ID, scope, and callback URL are showing properly (lower left)
24+
3. Click the Start button
25+
4. Sign in to Visual Studio Online (if necessary)
26+
5. Review and accept the authorization request
27+
28+
If everything is setup properly, Visual Studio Online will generate an access token and refresh token and both values will be displayed. **As an app developer, you would always keep these values secret**. Also a new authorization will appear on [your profile page](https://app.vssps.visualstudio.com/Profile/View).
29+
30+
With this access token, you can call [Visual Studio Online REST APIs](http://www.visualstudio.com/integrate/reference/reference-vso-overview-vsi) by passing the access token in the Authorization header. For example:
31+
32+
```
33+
Authorization: Bearer {your access token}
34+
```
35+

0 commit comments

Comments
 (0)