Skip to content

Commit

Permalink
fix: Send access token as a header instead of querystring parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
trodrigues committed Mar 18, 2016
1 parent 2b84d59 commit a03af6c
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/create-http-client.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import qs from 'querystring'
import version from '../version'

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

Expand All @@ -29,10 +29,6 @@ export default function createHttpClient (axios, {space, accessToken, insecure,
return axios.create({
baseURL: `${insecure ? 'http' : 'https'}://${hostname}:${port}/spaces/${space}/`,
headers: headers,
agent: agent,
params: {
access_token: accessToken
},
paramsSerializer: params => qs.stringify(params)
agent: agent
})
}

0 comments on commit a03af6c

Please sign in to comment.