Skip to content

Commit 260fc45

Browse files
Merge pull request #1238 from telerik/api-key-as-primary-auth-method
API key as primary auth method
2 parents 6b58dab + e7d42a9 commit 260fc45

File tree

12 files changed

+73
-81
lines changed

12 files changed

+73
-81
lines changed

_contentTemplates/common/nuget.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,28 @@ Visit <a href="https://status.telerik.com" target="_blank">status.telerik.com</a
1717
#end
1818

1919
#generate-nuget-key
20-
1. Go to the [**Manage NuGet Keys**](https://www.telerik.com/account/downloads/nuget-keys) page in your Telerik account.
20+
As the Telerik NuGet server requires authentication, the first step is to obtain an API key that you will use instead of a password. Using an API key instead of a password is a more secure approach, especially when working with [.NET CLI]({% slug nuget-dotnet-cli %}) or the [`NuGet.Config` file]({% slug nuget-config %}).
2121

22-
1. Select the **DOWNLOADS** tab and then **Manage NuGet Keys**.
22+
1. Go to the [API Keys](https://www.telerik.com/account/downloads/api-keys) page in your Telerik account.
23+
1. Click **Generate New Key +**.
2324

24-
![Manage NuGet Keys](../../installation/images/manage-nuget-keys.png)
25+
![Manage API Keys](/installation/images/account-generate-api-key.png)
2526

26-
1. To create a new key, select the **Generate New Key** button.
27+
1. In the **Key Note** field, add a note that describes the API key.
28+
1. Click **Generate Key**.
29+
1. Select **Copy and Close**. Once you close the window, you can no longer copy the generated key. For security reasons, the **API Keys** page displays only a portion of the key.
30+
1. Store the generated NuGet API key as you will need it in the next steps. Whenever you need to authenticate your system with the Telerik NuGet server, use `api-key` as the username and your generated API key as the password.
2731

28-
1. Enter a name for the NuGet Key, and then select **Generate Key**.
29-
30-
1. To copy the key, select **Copy and Close**. Once you close the window, you can no longer copy the generated key. For security reasons, the **NuGet Keys** page displays only a portion of the key.
31-
32-
![Copy Generated NuGet Key](../../installation/images/copy-nuget-key.png)
32+
#end
3333

34-
1. Store the generated NuGet API key as you will need it in the next step.
34+
#reset-store-credentials
35+
1. Remove the saved credentials in the [Windows Credential Manager](https://support.microsoft.com/en-us/windows/accessing-credential-manager-1b5c916a-6a16-889f-8581-fc16e8165ac0). These credentials will appear as `nuget.telerik.com` or `VSCredentials_nuget.telerik.com` entries.
36+
2. Remove the Telerik NuGet package source from Visual Studio.
37+
3. If you have added the Telerik package source by using the .NET CLI, try to remove it by running the following commands:
38+
* [`dotnet nuget list source`](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-list-source)
39+
* [`dotnet nuget remove source`](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-remove-source)
40+
4. Check if you have any credentials stored in `%AppData%\NuGet\Nuget.Config`. If so, remove them.
41+
5. Try to reset the Visual Studio user data by [forcing NuGet to ask for authentication](https://stackoverflow.com/questions/43550797/how-to-force-nuget-to-ask-for-authentication-when-connecting-to-a-private-feed).
42+
6. Restart Visual Studio.
43+
7. Add the Telerik NuGet package source again through Visual Studio or .NET CLI. If you are using the Telerik NuGet feed in a .NET Core application, use a [NuGet API key in the NuGet.Config file]({%slug nuget-config %}).
3544
#end

get-started/first-steps-vs-code.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,15 @@ If you encounter any issues creating the basic project, see the complete guide i
5858

5959
Telerik maintains a NuGet feed with official UI for .NET MAUI releases and service packs. These packages are available for registered users with an active trial or commercial license. Adding the Telerik NuGet server as a source lets you download and install Telerik packages containing controls and utilities. As Visual Studio Code does not offer a built-in NuGet packet manager, use .NET CLI to add a new package source.
6060

61-
To add the Telerik NuGet source using .NET CLI, use the command below. Replace the placeholders with your Telerik account user name and password.
61+
@[template](/_contentTemplates/common/nuget.md#generate-nuget-key)
62+
63+
Next, use the command below to add the Telerik NuGet source using .NET CLI. Replace the NuGet API key placeholder with the API key that you generated.
6264

6365
```bash
64-
dotnet nuget add source https://nuget.telerik.com/v3/index.json --name TelerikNuGetFeed --username <TELERIK EMAIL> --password <TELERIK PASSWORD> --store-password-in-clear-text
66+
dotnet nuget add source https://nuget.telerik.com/v3/index.json --name TelerikNuGetFeed --username api-key --password <YOUR-NUGET-API-KEY> --store-password-in-clear-text
6567
```
6668

67-
>caution Storing passwords in plain text is strongly discouraged. This guide uses the `--store-password-in-clear-text` only for simplicity. For real-world scenarios, use secure methods, such as encrypted passwords or API keys. See <a href="https://learn.microsoft.com/en-us/nuget/consume-packages/consuming-packages-authenticated-feeds#security-best-practices-for-managing-credentials" target="_blank">Microsoft's security best practices</a> for more information on how to securely store your NuGet source credentials.
69+
>See <a href="https://learn.microsoft.com/en-us/nuget/consume-packages/consuming-packages-authenticated-feeds#security-best-practices-for-managing-credentials" target="_blank">Microsoft's security best practices</a> for more information on how to securely store your NuGet source credentials.
6870
6971
## Step 4: Install the Telerik UI for .NET MAUI Controls
7072

get-started/first-steps-vs.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ If you encounter any issues creating the basic project, see the complete guide i
5151

5252
Telerik maintains a NuGet feed with official UI for .NET MAUI releases and service packs. These packages are available for registered users with an active trial or commercial license. Adding the Telerik NuGet server as a source in Visual Studio lets you download and install Telerik packages containing controls and utilities.
5353

54-
To add the Telerik NuGet source to Visual Studio:
54+
@[template](/_contentTemplates/common/nuget.md#generate-nuget-key)
55+
56+
Next, add the Telerik NuGet source to Visual Studio:
5557

5658
1. In Visual Studio go to **Tools** > **NuGet Package Manager** > **Package Manager Settings**.
5759

@@ -61,7 +63,7 @@ To add the Telerik NuGet source to Visual Studio:
6163

6264
1. Add the `https://nuget.telerik.com/v3/index.json` URL as a **Source**. Click **OK**.
6365

64-
1. Whenever Visual Studio displays a dialog to enter credentials for `nuget.telerik.com`, use your Telerik account email and password.
66+
1. Whenever Visual Studio displays a dialog to enter credentials for `nuget.telerik.com`, use `api-key` as the username and your NuGet API key as the password.
6567

6668
![Add the Telerik NuGet Feed in Visual Studio](./images/telerik-nuget-feed.png)
6769

@@ -71,7 +73,7 @@ To add the Telerik NuGet source to Visual Studio:
7173

7274
2. Install the Telerik UI for .NET MAUI package:
7375

74-
1. Select the `telerik.com` **Package source** that you [added earlier](#step-2-add-the-telerik-nuget-server). As this is a private NuGet feed, you must authenticate with your [Telerik account](https://www.telerik.com/account/) user name and password.
76+
1. Select the `telerik.com` **Package source** that you [added earlier](#step-2-add-the-telerik-nuget-server). As this is a private NuGet feed, you must authenticate using `api-key` as the username and [your NuGet API key](#step-3-add-the-telerik-nuget-server) as the password.
7577

7678
1. Select the **Browse** tab, enter `MAUI` in the search box, and then select the `Telerik.UI.for.Maui` package.
7779

13.3 KB
Loading
-18 KB
Binary file not shown.
8.27 KB
Loading

installation/nuget/nuget-config.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ An alternative way to configure your system to use the Telerik NuGet server is t
1313

1414
To configure the Telerik NuGet server as a package source directly in the `nuget.config` file, perform the following steps:
1515

16-
1. [Generate a NuGet API key](#generate-a-nuget-key).
16+
1. [Generate a NuGet API key](#generate-an-api-key).
1717
1. [Edit the NuGet.Config file](#edit-the-nugetconfig-file).
1818

19-
## Generate a NuGet Key
20-
21-
Generate a NuGet API key that you will use for the authentication by the Telerik NuGet server. This approach is more secure than using your Telerik credentials in <a href="https://learn.microsoft.com/en-us/nuget/consume-packages/consuming-packages-authenticated-feeds#credentials-in-nugetconfig-files
22-
" target="_blank">plain text</a>.
19+
## Generate an API Key
2320

2421
@[template](/_contentTemplates/common/nuget.md#generate-nuget-key)
2522

@@ -34,7 +31,7 @@ Generate a NuGet API key that you will use for the authentication by the Telerik
3431

3532
1. In the `nuget.config` file, add the Telerik feed by inserting the line `<add key="MyTelerikFeed" value="https://nuget.telerik.com/v3/index.json" protocolVersion="3"/>`in the `packageSources` section.
3633

37-
1. In the `packageSourceCredentials` section, add the [generated NuGet API key](#generate-a-nuget-key). Use `api-key` as a value for the user name.
34+
1. In the `packageSourceCredentials` section, add the [generated NuGet API key](#generate-an-api-key). Use `api-key` as a value for the user name.
3835

3936
```xml
4037
<configuration>
@@ -52,15 +49,9 @@ Generate a NuGet API key that you will use for the authentication by the Telerik
5249
</configuration>
5350
```
5451

55-
## Securing Your Credentials
56-
57-
This article does not cover the scenario of using your Telerik account credentials as <a href="https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#packagesourcecredentials
58-
" target="_blank">plain text</a> in the `NuGet.Config` file due to security concerns. However, you can still use the <a href="https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#packagesourcecredentials
59-
" target="_blank">plain text</a> approach if you must.
52+
## Securing Your API Key
6053

61-
>warning
62-
>* Never hard-code Telerik account credentials or NuGet API keys in a `NuGet.Config` file in a GitHub repository, Docker image, or any location that may be accessed by unauthorized parties. A NuGet key is valuable and bad actors can use it to access the NuGet packages that are licensed under your account. A credentials abuse can lead to a review of the affected Telerik account.
63-
>* If you use single sign-on (SSO) to login into your Telerik account, always use a [NuGet API key]({%slug nuget-keys%}) instead of plain text credentials in the `NuGet.Config` file.
54+
Never hard-code NuGet API keys in a `NuGet.Config` file in a GitHub repository, Docker image, or any location that may be accessed by unauthorized parties. A NuGet API key is valuable and bad actors can use it to access the NuGet packages that are licensed under your account. A credentials abuse can lead to a review of the affected Telerik account.
6455

6556
For more details about the `NuGet.Config` file, see the following Microsoft resources:
6657
* <a href="https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file#packagesources" target="_blank">Configuring the NuGet package sources</a>

installation/nuget/nuget-keys.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Using NuGet in CI Workflows
33
page_title: Using NuGet Packages in CI Workflows
4-
description: Learn how to use NuGet Keys to authenticate with the Telerik NuGet server and restore Telerik UI for .NET MAUI packages in your CI or desktop environment.
4+
description: Learn how to use API Keys to authenticate with the Telerik NuGet server and restore Telerik UI for .NET MAUI packages in your CI or desktop environment.
55
slug: nuget-keys
66
position: 8
77
---
@@ -10,48 +10,41 @@ position: 8
1010

1111
This article describes how to use token-based authentication for the Telerik NuGet feed. You will learn how to create and use NuGet API keys to restore Telerik NuGet packages in your Continuous Integration (CI) workflow.
1212

13-
The Telerik NuGet server allows you to authenticate by using two methods:
13+
When you need to restore Telerik NuGet packages as part of your CI, using API Keys provides a secure way to authenticate. This method does not require you to provide your Telerik username and password anywhere in the CI workflow. Unlike your Telerik credentials, an API Key has a limited scope and can be used only with the Telerik NuGet server. If any of your API Keys is compromised, you can quickly delete it and create a new one.
1414

15-
* Basic authentication by providing your Telerik user name and password.
16-
* Token-based authentication by providing a NuGet key (recommended).
17-
18-
When you need to restore Telerik NuGet packages as part of your CI, using NuGet keys is the more secure way to authenticate. This method does not require you to provide your Telerik username and password anywhere in the CI workflow.
19-
20-
Unlike your Telerik credentials, a NuGet Key has a limited scope and can be used only with the Telerik NuGet server. If any of your NuGet keys is compromised, you can quickly delete it and create a new one.
21-
22-
## Generating NuGet Keys
15+
## Generating API Keys
2316

2417
@[template](/_contentTemplates/common/nuget.md#generate-nuget-key)
2518

26-
## Storing a NuGet Key
19+
## Storing API Keys
2720

28-
> Never check in a NuGet Key with your source code or leave it publicly visible in plain text, for example, as a raw key value in a `nuget.config` file. A NuGet Key is valuable as bad actors can use it to access the NuGet packages that are licensed under your account. A potential key abuse can lead to a review of the affected account.
21+
> Never check in an API Key with your source code or leave it publicly visible in plain text, for example, as a raw key value in a `NuGet.Config` file. An API Key is valuable, as bad actors can use it to access the NuGet packages that are licensed under your account. A potential key abuse can lead to a review of the affected account.
2922
30-
To protect the NuGet Key, store it as a secret environment variable. The exact steps depend on your workflow:
23+
To protect the API Key, store it as a secret environment variable. The exact steps depend on your workflow:
3124

3225
* In GitHub Actions, save the key as a GitHub Actions Secret. Go to **Settings** > **Security** > **Secrets** > **Actions** > **Add new secret**.
3326

3427
* In Azure DevOps Classic, save the key as a secret pipeline variable. Go to the **Variables** tab and then select **Pipeline variables**.
3528

3629
* In Azure DevOps YAML pipelines, save the key as a secret variable as well. Click the YAML editor's **Variables** button and complete the **New variable** form.
3730

38-
If you use Azure DevOps Service connection instead of secret environment variables, enter `api-key` in the username filed and the NuGet Key as the password in the **New NuGet service connection** form editor.
31+
If you use Azure DevOps Service connection instead of secret environment variables, enter `api-key` in the username filed and the API Key as the password in the **New NuGet service connection** form editor.
3932

40-
For more details on storing and protecting your NuGet Key, check the [Announcing NuGet Keys](https://www.telerik.com/blogs/announcing-nuget-keys) blog post by Lance McCarthy.
33+
For more details on storing and protecting your API Key, check the [Announcing NuGet Keys](https://www.telerik.com/blogs/announcing-nuget-keys) blog post by Lance McCarthy.
4134

42-
## Using a NuGet Key
35+
## Using an API Key
4336

4437
There are two popular ways to use the Telerik NuGet server in a build:
4538

46-
* [Using a nuget.config file with your projects](#using-a-nugetconfig-file-with-your-projects)
39+
* [Using a NuGet.Config file with your projects](#using-a-nugetconfig-file-with-your-projects)
4740

4841
* [Using only CLI commands](#using-only-cli-commands)
4942

50-
For more information on how to use NuGet keys in a build, check the [Announcing NuGet Keys](https://www.telerik.com/blogs/announcing-nuget-keys) blog post by Lance McCarthy.
43+
For more information on how to use API Keys in a build, check the [Announcing NuGet Keys](https://www.telerik.com/blogs/announcing-nuget-keys) blog post by Lance McCarthy.
5144

5245
### Using a NuGet.Config File with Your Projects
5346

54-
**1.** In your `nuget.config` file, set the `Username` value to `api-key` and the `ClearTextPassword` value to an environment variable name:
47+
**1.** In your `NuGet.Config` file, set the `Username` value to `api-key` and the `ClearTextPassword` value to an environment variable name:
5548

5649
```xml
5750
<configuration>
@@ -75,7 +68,7 @@ The exact steps to set the `MY_API_KEY` environment variable depend on your work
7568

7669
### Using .NET CLI Commands
7770

78-
You can use the CLI `add source` (or `update source`) command to set the credentials of a package source. This CLI approach is applicable if your CI system doesn't support default environment variable secrets or if you do not use a custom `nuget.config`.
71+
You can use the CLI `add source` (or `update source`) command to set the credentials of a package source. This CLI approach is applicable if your CI system doesn't support default environment variable secrets or if you do not use a custom `NuGet.Config`.
7972

8073
* To set the credentials in Azure DevOps:
8174

installation/nuget/nuget-troubleshooting.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ You can quickly test your credentials or a specific package search results, the
3232
1. Enter [https://nuget.telerik.com/v3/index.json](https://nuget.telerik.com/v3/index.json) in the address bar and hit `Enter`.
3333
1. The web browser will prompt you to login, enter the credentials you want to test. You can test either:
3434
* Telerik Account credentials (email address and password)
35-
* Telerik NuGet Key (username "api-key", password is the full key value)
35+
* Telerik API Key (username "api-key", password is the full key value)
3636
1. You should now see a json result containing the general index listing. This confirms a successful login!
3737
1. Confirm Package Listing
3838
1. Enter [https://nuget.telerik.com/v3/search?q=telerik.ui.for.maui](https://nuget.telerik.com/v3/search?q=telerik.ui.for.maui) in the address bar and hit Enter.
3939
1. You should now see a json result containing a list of available packages that match the query.
40-
1. If you want to try again with different credentials (i.e. a different nuget key), close the incognito browser session and open a new one.
40+
1. If you want to try again with different credentials (i.e. a different NuGet API key), close the incognito browser session and open a new one.
4141

42-
>Tip If you get an error at any point in this process, review the list above for the specific error message and follow those dedicated instructions. For example, you may need to visit the [401 Unauthorized]({%slug error-unauthorized%}) or [401 Logon failed error]({%slug error-login-failed%}) articles. Alternatively, if you authenticate and get a json response, but the package version you're expecting isn't listed, the [Package Version Not Found]({%slug package-version-not-found%}) article is more relevant.
42+
>Tip If you get an error at any point in this process, review the list above for the specific error message and follow those dedicated instructions. For example, you may need to visit the [401 Unauthorized]({%slug error-unauthorized%}) or [401 Logon failed error]({%slug error-login-failed%}) articles. Alternatively, if you authenticate and get a json response, but the package version you're expecting isn't listed, the [Package Version Not Found]({%slug package-version-not-found%}) article is more relevant.
4343
4444
@[template](/_contentTemplates/common/nuget.md#status-telerik-com)

0 commit comments

Comments
 (0)