diff --git a/lib/travis/api/app/endpoint/authorization.rb b/lib/travis/api/app/endpoint/authorization.rb index f7273db8..2885b637 100644 --- a/lib/travis/api/app/endpoint/authorization.rb +++ b/lib/travis/api/app/endpoint/authorization.rb @@ -142,7 +142,7 @@ class Travis::Api::App def user_for_github_token(token) data = GH.with(token: token.to_s) { GH['user'] } scopes = parse_scopes data.headers['x-oauth-scopes'] - user = User.find_by_login(data['login']) + user = User.find_by_github_id(data['id']) halt 403, 'not a Travis user' if user.nil? halt 403, 'insufficient access' unless acceptable? scopes