You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ClientLibraryConsoleAppSample/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Client Libraries Sample
2
2
3
-
The [Client Libraries](https://www.visualstudio.com/en-us/docs/integrate/get-started/client-libraries/dotnet) are .NET libraries made to simplify integration with Visual Studio Team Services and Team Foundation Server (2015 and later). They allow access to both the Traditional Client Object Model and [new REST APIs](https://www.visualstudio.com/en-us/docs/integrate/api/overview).
3
+
For native applications the best way to authenticate and access VSTS resources is using the [Client Libraries](https://www.visualstudio.com/en-us/docs/integrate/get-started/client-libraries/dotnet). They are .NET libraries made to simplify integration with Visual Studio Team Services and Team Foundation Server (2015 and later). They allow access to both the Traditional Client Object Model and [new REST APIs](https://www.visualstudio.com/en-us/docs/integrate/api/overview).
Copy file name to clipboardExpand all lines: JavascriptWebAppSample/README.md
+10-9Lines changed: 10 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,10 @@
1
-
# Javascirpt Web App Sample
1
+
# Javascript Web App Sample
2
2
3
-
The [Azure Active Directory Authentication Library (ADAL)](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-authentication-libraries) enables client application developers to authenticate cloud users and obtain access tokens for API usage.
3
+
For javascript web applications that want access to resources like VSTS REST API's, they will have to support an authentication flow for their users. The [Azure Active Directory Authentication Library (ADAL) for JS](https://github.com/AzureAD/azure-activedirectory-library-for-js) enables javascript application developers to setup inerative authentication flows and obtain access tokens for API usage.
4
4
5
5
## Sample Application
6
6
7
-
This buildable sample will walk you through the steps to create single page javascript application which uses ADAL to authenticate a user via an interactive prompt and display all project contained in a VSTS account/TFS collection.
7
+
This buildable sample will walk you through the steps to create a single page javascript application which uses ADAL to authenticate a user via an interactive prompt and display all projects contained in a VSTS account/TFS collection.
8
8
9
9
To run this sample you will need:
10
10
* Http-server. You can download [NPM http server](https://www.npmjs.com/package/http-server) if you need one.
1. Sign in to the [Azure Portal](https://portal.azure.com).
25
25
2. On the top bar, click on your account and under the Directory list, choose the Active Directory tenant where you wish to register your application.
26
26
3. On the left hand navigation menu, select `Azure Active Directory`.
27
-
4. Click on `App registrations` and select `New application regirstation` from the top bar.
27
+
4. Click on `App registrations` and select `New application registration` from the top bar.
28
28
5. Enter a `name` for you application, ex. "Adal JS sample", choose `Web app/API` for `application type`, and enter `http://localhost:8080` for the `Redirect URI`. Finally click `create` at the bottom of the screen.
29
29
6. Save the `Application ID` from your new application registration. You will need it later in this sample.
30
30
7. Grant Permissions for VSTS. Click `Required permissions` -> `add` -> `1 Select an API` -> type in and select `Microsoft Visual Studio Team Services` -> check the box for `Have full access to...` -> click `Save` -> click `Grant Permissions` -> click `Yes`.
31
31
32
32
## Step 3: Run the sample
33
33
34
34
1. Open `index.html` in [Visual Studio Code](https://code.visualstudio.com/download?wt.mc_id=adw-brandcore-editor-slink-downloads&gclid=EAIaIQobChMItJndsOXH1QIVFJR-Ch3uTgMREAAYASABEgLb2vD_BwE) or another text editor or IDE.
35
-
2. Inside `index.html` there is a section of `Input Vars` you can update to run the sample:
36
-
*`clientId` - (Required) update this with the `application id` you saved from `portal.azure.com`
37
-
*`replyUri` - (optional) update this if you are hosting `index.html` at an address other than `hottp://localhost:8080`
38
-
*`vstsApi` - (Required) update this with your VSTS/TFS collection, e.g. http://myaccount.visualstudio.com/DefaultCollection/_apis/projects?api-version=2.0 for VSTS or http://myserver:8080/tfs/DefaultCollection/_apis/projects?api-version=2.0 for TFS. If you would like to the sample to run a different VSTS API please change the entire string
35
+
2. Inside `index.html` there is a section called `Input Vars` you will need to update to run the sample:
36
+
*`clientId` - (Required) update this with the `application id` you saved from step 2.6 above
37
+
*`replyUri` - (optional) In single page apps this should be the app URL itself. We have set this to `http://localhost:8080`(where we will host our app), but if you are hosting your app at another URL please change this value and the reply URI in `portal.azure.com`
38
+
*`logoutredirectUri` - (optional) update if you are hosting your app at a location other than `http://localhost:8080`
39
+
*`vstsApi` - (Required) update this with your VSTS/TFS collection, e.g. http://myaccount.visualstudio.com/DefaultCollection/_apis/projects?api-version=2.0 for VSTS or http://myserver:8080/tfs/DefaultCollection/_apis/projects?api-version=2.0 for TFS. If you would like to the sample to run a different VSTS API please change the entire string. [Learn more about other VSTS REST API's](https://www.visualstudio.com/en-us/docs/integrate/get-started/rest/basics)
39
40
*`vstsResourceId` - Do not change this value. It is used to receive VSTS ADAL authentication tokens
40
-
3. Navigate to the ADAL JS sample in cloned repo `vsts-auth-samples/AdalJsSample/` and start your http-server which will serve `index.hmtl` at `http://localhost:8080`.
41
+
3. Navigate to the ADAL JS sample in cloned repo `vsts-auth-samples/JavascriptWebAppSample/` and start your http-server which will by default serve `index.hmtl` at `http://localhost:8080`.
41
42
4. Navigate to `http://localhost:8080`. Sign in with a user account from your AAD tenant which has access to the VSTS account specified in the `vstsApi`. All projects contained in the account should be displayed.
Copy file name to clipboardExpand all lines: JavascriptWebAppSample/index.html
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -20,15 +20,17 @@
20
20
<scripttype="text/javascript">
21
21
//========= Input Vars ================================
22
22
varclientId='57c5c51c-2036-433a-befa-ebefc7f10689';//Update with your app regirstion's Application ID
23
-
varreplyUri='http://localhost:8080';//Update if hosting webpage non-locally
24
-
varvstsApi='https://myaccount.visualstudio.com/DefaultCollection/_apis/projects?api-version=2.0';//'https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=1.0';//Update if want to access a different vsts API
23
+
varreplyUri='http://localhost:8080';//Where you will receive the token.
24
+
varlogoutRedirectUri='http://localhost:8080';//Update if you are hosting your webpage somewhere else
25
+
varvstsApi='https://myaccount.visualstudio.com/_apis/projects?api-version=2.0';//'https://app.vssps.visualstudio.com/_apis/profile/profiles/me?api-version=1.0';//Update if want to access a different vsts API
25
26
varvstsResourceId='499b84ac-1321-427f-aa17-267ca6975798';//Do not change
Copy file name to clipboardExpand all lines: ManagedClientConsoleAppSample/README.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,15 @@
1
1
# Managed Client ADAL Sample
2
2
3
-
The [Azure Active Directory Authentication Library (ADAL)](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-authentication-libraries) enables client application developers to authenticate cloud users and obtain access tokens for API usage.
3
+
For native applications which can support interative authentication prompts, the [Azure Active Directory Authentication Library (ADAL)](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-authentication-libraries) makes it easy to setup authentication flows for users.
4
+
5
+
For native applications which cannot support interactive authentication prompts, please check out our [Device Profile Sample](./../DeviceProfileSample/README.md).
4
6
5
7
## Sample Application
6
8
7
9
This buildable sample will walk you through the steps to create a client-side console application which uses ADAL to authenticate a user via an interactive prompt and return a list of all projects inside a selected VSTS account/TFS collection.
8
10
9
11
To run this sample you will need:
10
-
* Visual Studio 2017
12
+
*[Visual Studio IDE](https://www.visualstudio.com/vs/)
11
13
* An Azure Active Directory (AAD) tenant. If you do not have one, follow these [steps to set up an AAD](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-howto-tenant)
12
14
* A user account in your AAD tenant
13
15
* A VSTS account backed by your AAD tenant where your user account has access. If you have an existing VSTS account not connected to your AAD tenant follow these [steps to connect you AAD tenant to your VSTS account](https://www.visualstudio.com/en-us/docs/setup-admin/team-services/manage-organization-access-for-your-account-vs)
2. On the top bar, click on your account and under the Directory list, choose the Active Directory tenant where you wish to register your application.
26
28
3. On the left hand navigation menu, select `Azure Active Directory`.
27
29
4. Click on `App registrations` and select `New application regirstation` from the top bar.
28
-
5. Enter a `name` for you application, ex. "Adal native app sample", choose `Native` for `application type`, and enter `http://localhost:8080` for the `Redirect URI`. Finally click `create` at the bottom of the screen.
30
+
5. Enter a `name` for you application, ex. "Adal native app sample", choose `Native` for `application type`, and enter `http://adaljssample` for the `Redirect URI`. Finally click `create` at the bottom of the screen.
29
31
6. Save the `Application ID` from your new application registration. You will need it later in this sample.
30
32
7. Grant Permissions for VSTS. Click `Required permissions` -> `add` -> `1 Select an API` -> type in and select `Microsoft Visual Studio Team Services` -> check the box for `Have full access to...` -> click `Save` -> click `Grant Permissions` -> click `Yes`.
31
33
@@ -41,9 +43,6 @@ Package: `Microsoft.Identity.Model.Clients.ActiveDirectory` has already been ins
41
43
4. Open CS file `Program.cs` and there is a section with input values to change at the top of the class:
42
44
*`vstsCollectionUrl` - update this with the url to your VSTS/TFS collection, e.g. http://myaccount.visualstudio.com for VSTS or http://myserver:8080/tfs/DefaultCollection for TFS.
43
45
*`clientId` - update this with the `application id` you saved from `portal.azure.com`
44
-
*`replyUri` - we have set this to `http://localhost:8080`, but please update it as necessary for your own app.
46
+
*`replyUri` - we have set this to `http://adaljssample`, but please update it as necessary for your own app.
45
47
5. Build and run solution. After running you should see an interactive login prompt. Then after authentication and authorization, a list of all projects inside of your account.
0 commit comments