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
> As of July 2024, Azure DevOps Personal Access Tokens (PATs) are [82 characters long](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#changes-to-format). Some tools may insert automatic line breaks when encoding tokens to Base64. To avoid this, use the `-w0` flag with the *base64* command to ensure the output stays on a single line.
77
+
> In this tutorial, we use Node’s Buffer method, which produces a single-line *Base64* string by default.
78
+
75
79
1. Open your `.npmrc` file and replace the placeholder `[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]` with your encoded personal access token you just created.
Azure Artifacts enables developers to manage packages from various sources, including public registries like *npmjs.com* and private feeds. To authenticate with Azure Artifacts, you need to configure your *.npmrc* config file. This file stores feed URLs and credentials used by npm, and it allows you to customize client behavior such as setting up proxies, defining default package locations, or configuring access to private feeds. The *.npmrc* file is typically located in the user's home directory, but can also be created at the project level to override default settings.
17
+
Azure Artifacts enables developers to manage packages from various sources, including public registries like *npmjs.com* and private feeds. To authenticate with Azure Artifacts, you need to configure your *npmrc* config file. This file stores feed URLs and credentials used by npm, and it allows you to customize client behavior such as setting up proxies, defining default package locations, or configuring access to private feeds. The *npmrc* file is typically located in the user's home directory, but can also be created at the project level to override default settings.
18
18
19
19
## Prerequisites
20
20
@@ -113,13 +113,17 @@ The following steps guide you through setting up the project-level configuration
> As of July 2024, Azure DevOps Personal Access Tokens (PATs) are [82 characters long](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#changes-to-format). Some tools may insert automatic line breaks when encoding tokens to Base64. To avoid this, use the `-w0` flag with the *base64* command to ensure the output stays on a single line.
118
+
> In this tutorial, we use Node’s Buffer method, which produces a single-line *Base64* string by default.
119
+
116
120
1. If you're using Linux or macOS, you can run the following command in your terminal to convert your personal access token (PAT) to a Base64-encoded string. Copy the resulting value to use in the next step.
117
121
118
122
```
119
-
echo -n "YOUR_PERSONAL_ACCESS-TOKEN" | base64
123
+
echo -n "YOUR_PERSONAL_ACCESS-TOKEN" | base64 -w0
120
124
```
121
125
122
-
1. Replace the placeholders *[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]* in your user-level *.npmrc* file with the Base64-encoded personal access token you generated in the previous step.
126
+
1. Replace the placeholders *[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]* in your user-level *npmrc* file with the Base64-encoded personal access token you generated in the previous step.
123
127
124
128
* * *
125
129
@@ -135,7 +139,7 @@ The following steps guide you through setting up the project-level configuration
135
139
136
140
:::image type="content" source="../media/server-2022-1-connect-to-feed.png" alt-text="A screenshot showing how to connect to a feed in Azure DevOps Server 2022.1.":::
137
141
138
-
1. Select **npm** from the left, and then follow the steps in the **Project setup** section to configure your .npmrc. file and authenticate with your feed.
142
+
1. Select **npm** from the left, and then follow the steps in the **Project setup** section to configure your *npmrc* file and authenticate with your feed.
139
143
140
144
:::image type="content" source="../media/npm-project-setup-server-2022-1.png" alt-text="A screenshot showing how to set up your npm project in Azure DevOps Server 2022.1.":::
141
145
@@ -147,7 +151,7 @@ The following steps guide you through setting up the project-level configuration
147
151
148
152
1. Select **Connect to Feed** and then select **npm** from the left navigation pane.
149
153
150
-
1. Add a *.npmrc* file in your project's directory, in the same directory as your *package.json* file, and paste the snippet provided in the **Project setup** section into your *.npmrc* file. Your file should look similar to the following:
154
+
1. Add a *.npmrc* file in your project's directory, in the same directory as your *package.json* file, and paste the snippet provided in the **Project setup** section into your *npmrc* file. Your file should look similar to the following:
> As of July 2024, Azure DevOps Personal Access Tokens (PATs) are [82 characters long](../../organizations/accounts/use-personal-access-tokens-to-authenticate.md#changes-to-format). Some tools may insert automatic line breaks when encoding tokens to Base64. To avoid this, use the `-w0` flag with the *base64* command to ensure the output stays on a single line.
202
+
> In this tutorial, we use Node’s Buffer method, which produces a single-line *Base64* string by default.
203
+
196
204
1. Replace the placeholders *[BASE64_ENCODED_PERSONAL_ACCESS_TOKEN]* in your user-level *.npmrc* file with the Base64-encoded personal access token you generated in the previous step.
197
205
198
206
* * *
@@ -221,7 +229,7 @@ The following steps guide you through setting up the project-level configuration
221
229
222
230
1. Select **Connect to Feed** and then select **npm** from the left navigation pane.
223
231
224
-
1. Add a *.npmrc* file in your project's directory, in the same directory as your *package.json* file, and paste the snippet provided in the **Project setup** section into your *.npmrc* file. Your file should look similar to the following:
232
+
1. Add a *.npmrc* file in your project's directory, in the same directory as your *package.json* file, and paste the snippet provided in the **Project setup** section into your *npmrc* file. Your file should look similar to the following:
0 commit comments