Skip to content
This repository was archived by the owner on Jun 8, 2023. It is now read-only.

Commit 0b7daf0

Browse files
Merge pull request #1472 from ngs/asana-auth
Use ScopedClient:auth instead of building Authorization header
2 parents cdf0c8f + 32e8cb5 commit 0b7daf0

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/scripts/asana.coffee

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,17 @@ api_key = process.env.HUBOT_ASANA_API_KEY
3131

3232

3333
getRequest = (msg, path, callback) ->
34-
auth = 'Basic ' + new Buffer("#{api_key}:").toString('base64')
3534
msg.http("#{url}#{path}")
36-
.headers("Authorization": auth, "Accept": "application/json")
35+
.headers("Accept": "application/json")
36+
.auth(api_key, '')
3737
.get() (err, res, body) ->
3838
callback(err, res, body)
3939

4040
postRequest = (msg, path, params, callback) ->
4141
stringParams = JSON.stringify params
42-
auth = 'Basic ' + new Buffer("#{api_key}:").toString('base64')
4342
msg.http("#{url}#{path}")
44-
.headers("Authorization": auth, "Content-Length": stringParams.length, "Accept": "application/json")
43+
.headers("Content-Length": stringParams.length, "Accept": "application/json")
44+
.auth(api_key, '')
4545
.post(stringParams) (err, res, body) ->
4646
callback(err, res, body)
4747

0 commit comments

Comments
 (0)