Last active
November 18, 2022 19:16
-
-
Save jnerius/0e639c09f7708ef3bdf15f264375dd6c to your computer and use it in GitHub Desktop.
Revisions
-
jnerius revised this gist
Mar 13, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,5 +18,5 @@ OAuthGitHubHandler.prototype = Object.extendsObject(OAuthUtil, { paramMap.put('expires_in', '365246060'); }, type: 'OAuthGitHubHandler' }); -
jnerius created this gist
Mar 13, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ var OAuthGitHubHandler = Class.create(); OAuthGitHubHandler.prototype = Object.extendsObject(OAuthUtil, { // Override postprocessAccessToken method. GitHub returns a urlencoded // body, so we need to break this apart and extract the values. postprocessAccessToken: function(accessTokenResponse) { var contentType = accessTokenResponse.getContentType(); var contentBody = accessTokenResponse.getBody(); var paramMap = accessTokenResponse.getparameters(); var params = contentBody.split('&'); var parts; params.forEach(function(param) { parts = param.split('='); paramMap.put(parts[0], parts[1]); }); // GitHub tokens do not expire, hardcode expiration to something far away paramMap.put('expires_in', '365246060'); }, type: 'OAuthUtil' });