|
1 | | -# ASP.NET web app (OAuth sample) |
| 1 | +# ASP.NET web app (VSTS OAuth sample) |
2 | 2 |
|
3 | 3 | This sample shows how to prompt a user to authorize a cloud service that can call APIs on Visual Studio Team Services on behalf of the user. |
4 | 4 |
|
5 | | -To learn more about OAuth in Visual Studio Team Services, see [Authorize access with OAuth 2.0](https://www.visualstudio.com/docs/integrate/get-started/authentication/oauth) |
| 5 | +To learn more about OAuth in Visual Studio Team Services, see [Authorize access to VSTS with OAuth 2.0](https://docs.microsoft.com/vsts/integrate/get-started/authentication/oauth?view=vsts) |
6 | 6 |
|
7 | 7 | ## How to setup |
8 | 8 |
|
9 | | -> 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/documentation/articles/web-sites-dotnet-get-started). |
| 9 | +> These instructions assume you will be deploying this sample app to an Azure web app. To learn more and to get started, visit [Get started with Azure Web Apps and ASP.NET](https://docs.microsoft.com/azure/app-service/app-service-web-get-started-dotnet-framework). |
10 | 10 |
|
11 | 11 | 1. Register an OAuth client app in Visual Studio Team Services (https://app.vsaex.visualstudio.com/app/register) |
12 | | - * The callback URL should be https://yoursite.azurewebsites.net/oauth/callback, where "yoursite" is the name of your Azure web site |
13 | | -2. Clone this repository |
14 | | -3. Open the solution (VstsOAuthSample.sln) in Visual Studio 2015 or later |
15 | | -4. Update the following settings in web.config to match the values in the app you just registered: |
16 | | - * App ID |
17 | | - * App Secret (use the "Client Secret" shown on the VSTS Application Settings page, not the App Secret) |
18 | | - * Scope (space separated) |
19 | | - * Callback URL |
20 | | -5. Build the solution (this will trigger a NuGet package restore, which will pull in all dependencies of the project) |
21 | | -6. Deploy the app to Azure |
| 12 | + * The callback URL should be https://yoursite.azurewebsites.net/oauth/callback, where `yoursite` is the name of your Azure web app |
| 13 | + |
| 14 | +2. Clone this repository and open the solution `OAuthWebSample\OAuthWebSample.sln` in Visual Studio 2015 or later |
| 15 | + |
| 16 | +3. Update the following settings in web.config to match the values in the app you just registered: |
| 17 | + * `ClientAppID` |
| 18 | + * `ClientAppSecret` (use the "Client Secret" shown on the VSTS Application Settings page, not the App Secret) |
| 19 | + * `Scope` (space separated) |
| 20 | + * `CallbackUrl` |
| 21 | + |
| 22 | +4. Build the solution (this will trigger a NuGet package restore, which will pull in all dependencies of the project) |
| 23 | + |
| 24 | +5. Publish the app to Azure |
22 | 25 |
|
23 | 26 | ### Run the sample |
24 | 27 |
|
25 | | -1. Navigate to the deployed app (https://yoursite.azurewebsites.net) |
| 28 | +1. Navigate to your app (https://yoursite.azurewebsites.net) |
| 29 | + |
26 | 30 | 2. Confirm your App ID, scope, and callback URL are displayed properly |
27 | | -  |
28 | | -3. Click **Start** |
| 31 | +  |
| 32 | + |
| 33 | +3. Click **Authorize** |
| 34 | + |
29 | 35 | 4. Sign in to Visual Studio Team Services (if prompted) |
| 36 | + |
30 | 37 | 5. Review and accept the authorization request |
31 | 38 |
|
32 | 39 | If everything is setup properly, Visual Studio Team Services will issue an access token and refresh token and both values will be displayed. **You should keep these values secret**. Also a new authorization will appear in [your profile page](https://app.vssps.visualstudio.com/Profile/View). |
|
0 commit comments