Skip to content

Commit

Permalink
back to common
Browse files Browse the repository at this point in the history
  • Loading branch information
x-ror committed Dec 15, 2020
1 parent 52c46c8 commit a3b701c
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 16 deletions.
2 changes: 2 additions & 0 deletions dist/index.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("node-fetch"),e=require("passport-oauth2");function r(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var a=r(t),i=r(e);class o extends i.default{constructor(t,e){super({...t,authorizationURL:"https://id.twitch.tv/oauth2/authorize",tokenURL:"https://id.twitch.tv/oauth2/token"},e),this.name="twitch",this.clientID=t.clientID,this._oauth2.setAuthMethod("Bearer"),this._oauth2.useAuthorizationHeaderforGET(!0)}userProfile(t,e){return a.default("https://api.twitch.tv/helix/users",{method:"GET",headers:{"Client-ID":this.clientID,Accept:"application/vnd.twitchtv.v5+json",Authorization:"Bearer "+t}}).then(t=>{if(t.ok)return t.json();throw new i.default.InternalOAuthError("failed to fetch user profile",t)}).then(t=>{const r=t.data[0];return r.provider="twitch",r.display_name&&(r.displayName=r.display_name,delete r.display_name),e(null,r)}).catch(t=>e(t,null))}authenticate(t,e){super.authenticate(t,e)}authorizationParams(t){return{force_verify:"boolean"==typeof t.forceVerify&&t.forceVerify}}}const n=o;exports.OAuth2Strategy=n,exports.Strategy=o;
//# sourceMappingURL=index.cjs.map
2 changes: 1 addition & 1 deletion dist/modern.js.map → dist/index.cjs.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions dist/index.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.js.map

This file was deleted.

Loading

0 comments on commit a3b701c

Please sign in to comment.