Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
fix(registry): encode username and password for auth
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed May 25, 2017
1 parent 5d36d94 commit c48b651
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/fetchers/registry/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ function getHeaders (uri, registry, opts) {
if (shouldAuth && auth.token) {
headers.authorization = `Bearer ${auth.token}`
} else if (shouldAuth && auth.username && auth.password) {
const encoded = Buffer.from(
`${auth.username}:${auth.password}`, 'utf8'
).toString('base64')
const username = encodeURIComponent(auth.username)
const password = encodeURIComponent(auth.password)
const encoded = Buffer.from(`${username}:${password}`).toString('base64')
headers.authorization = `Basic ${encoded}`
}
return headers
Expand Down

0 comments on commit c48b651

Please sign in to comment.