Skip to content

Commit 4489ca8

Browse files
committed
Merge pull request #67 from contentful/auth-header
fix: Send access token as a header instead of querystring parameter
2 parents 2b84d59 + a03af6c commit 4489ca8

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/create-http-client.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import qs from 'querystring'
21
import version from '../version'
32

43
/**
@@ -19,6 +18,7 @@ export default function createHttpClient (axios, {space, accessToken, insecure,
1918
hostname = hostname || 'cdn.contentful.com'
2019
port = port || (insecure ? 80 : 443)
2120
headers = headers || {}
21+
headers['Authorization'] = 'Bearer ' + accessToken
2222
headers['Content-Type'] = 'application/vnd.contentful.delivery.v1+json'
2323
headers['X-Contentful-User-Agent'] = 'contentful.js/' + version
2424

@@ -29,10 +29,6 @@ export default function createHttpClient (axios, {space, accessToken, insecure,
2929
return axios.create({
3030
baseURL: `${insecure ? 'http' : 'https'}://${hostname}:${port}/spaces/${space}/`,
3131
headers: headers,
32-
agent: agent,
33-
params: {
34-
access_token: accessToken
35-
},
36-
paramsSerializer: params => qs.stringify(params)
32+
agent: agent
3733
})
3834
}

0 commit comments

Comments
 (0)