From 44d6c0259175ce3f89f41721350d34eb494ca3d4 Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Mon, 10 Dec 2012 15:49:37 +0100 Subject: [PATCH] actually check if github sent a token --- lib/travis/api/app/endpoint/authorization.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/travis/api/app/endpoint/authorization.rb b/lib/travis/api/app/endpoint/authorization.rb index 19114203..0004a82f 100644 --- a/lib/travis/api/app/endpoint/authorization.rb +++ b/lib/travis/api/app/endpoint/authorization.rb @@ -227,7 +227,9 @@ class Travis::Api::App def get_token(endoint, values) response = Faraday.post(endoint, values) parameters = Addressable::URI.form_unencode(response.body) - parameters.assoc("access_token").last + token_info = parameters.assoc("access_token") + halt 401, 'could not resolve github token' unless token_info + token_info.last end def parse_scopes(data)