hapi-oauth
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -1,3 +0,3 @@ | ||
import { Request } from "hapi"; | ||
import { Provider } from "./provider"; | ||
import { Request } from 'hapi'; | ||
import { Provider } from './provider'; | ||
export interface LinkSuccess { | ||
@@ -4,0 +4,0 @@ provider: Provider; |
@@ -1,4 +0,4 @@ | ||
import * as Hapi from "hapi"; | ||
import { OAuthHandler } from "./handler"; | ||
import { Provider } from "./provider"; | ||
import * as Hapi from 'hapi'; | ||
import { OAuthHandler } from './handler'; | ||
import { Provider } from './provider'; | ||
export interface PluginOptions { | ||
@@ -5,0 +5,0 @@ providers: Provider[]; |
@@ -13,10 +13,10 @@ "use strict"; | ||
const provider_1 = require("./provider"); | ||
const pkg = require('../package.json'); | ||
const info_1 = require("./info"); | ||
exports.plugin = { | ||
name: pkg.name, | ||
version: pkg.version, | ||
name: info_1.name, | ||
version: info_1.version, | ||
register(server, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!options.providers) { | ||
throw new Error("Providers array not supplied"); | ||
throw new Error('Providers array not supplied'); | ||
} | ||
@@ -23,0 +23,0 @@ options.baseUrl = options.baseUrl || server.info.uri; |
@@ -1,4 +0,4 @@ | ||
import * as Hapi from "hapi"; | ||
import { PluginOptions } from "./plugin"; | ||
import { Profile } from "./profile"; | ||
import * as Hapi from 'hapi'; | ||
import { PluginOptions } from './plugin'; | ||
import { Profile } from './profile'; | ||
export declare type Scopes = string[] | ((provider: string, req: Hapi.Request) => string[]); | ||
@@ -5,0 +5,0 @@ export interface AccessTokens { |
@@ -19,6 +19,6 @@ "use strict"; | ||
} | ||
return this.getScopes(req).join(" "); | ||
return this.getScopes(req).join(' '); | ||
} | ||
getScopes(req) { | ||
if (typeof this.scopes === "function") { | ||
if (typeof this.scopes === 'function') { | ||
return this.scopes(this.name, req); | ||
@@ -30,3 +30,3 @@ } | ||
const query = { | ||
response_type: "code", | ||
response_type: 'code', | ||
redirect_uri: redirectUri, | ||
@@ -37,3 +37,3 @@ client_id: this.clientId, | ||
if (scopes) { | ||
query["scope"] = scopes; | ||
query['scope'] = scopes; | ||
} | ||
@@ -53,3 +53,3 @@ return options.handler | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}, | ||
@@ -72,3 +72,3 @@ }, (err, message, res) => { | ||
extractCode(req) { | ||
return req.query["code"]; | ||
return req.query['code']; | ||
} | ||
@@ -79,3 +79,3 @@ handleCode(request, options, redirectUri) { | ||
if (!code) { | ||
throw Boom.unauthorized("Missing code"); | ||
throw Boom.unauthorized('Missing code'); | ||
} | ||
@@ -86,3 +86,3 @@ return this.requestToken(code, redirectUri).then(data => options.handler.onLink({ provider: this, data }, request), error => options.handler.onError({ provider: this, error }, request)); | ||
/*abstract*/ getProfile(tokens) { | ||
throw new Error("Not implemented"); | ||
throw new Error('Not implemented'); | ||
} | ||
@@ -94,3 +94,3 @@ } | ||
server.route({ | ||
method: "GET", | ||
method: 'GET', | ||
path: `/oauth/${provider.name}/request`, | ||
@@ -105,3 +105,3 @@ options: options.requestConfig, | ||
server.route({ | ||
method: "GET", | ||
method: 'GET', | ||
path: `/oauth/${provider.name}`, | ||
@@ -108,0 +108,0 @@ options: options.linkConfig, |
@@ -1,3 +0,3 @@ | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
export declare class DiscordProfile implements Profile { | ||
@@ -4,0 +4,0 @@ id: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const { name, version } = require("../../../package.json"); | ||
const node_fetch_1 = require("node-fetch"); | ||
const querystring_1 = require("querystring"); | ||
const provider_1 = require("../provider"); | ||
const info_1 = require("../info"); | ||
class DiscordProfile { | ||
@@ -22,13 +22,13 @@ constructor(profile) { | ||
this.scopes = scopes; | ||
this.name = "discord"; | ||
this.tokenUrl = "https://discordapp.com/api/oauth2/token"; | ||
this.authUrl = "https://discordapp.com/api/oauth2/authorize"; | ||
this.profileUrl = "https://discordapp.com/api/users/@me"; | ||
this.name = 'discord'; | ||
this.tokenUrl = 'https://discordapp.com/api/oauth2/token'; | ||
this.authUrl = 'https://discordapp.com/api/oauth2/authorize'; | ||
this.profileUrl = 'https://discordapp.com/api/users/@me'; | ||
} | ||
requestToken(code, redirect_uri) { | ||
return node_fetch_1.default(this.tokenUrl, { | ||
method: "POST", | ||
method: 'POST', | ||
headers: { | ||
"Accept-Encoding": "gzip,deflate", | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
'Accept-Encoding': 'gzip,deflate', | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
}, | ||
@@ -40,3 +40,3 @@ body: querystring_1.stringify({ | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}), | ||
@@ -52,4 +52,4 @@ compress: true, | ||
Authorization: `Bearer ${tokens.access_token}`, | ||
"Accept-Encoding": "gzip,deflate", | ||
"User-Agent": `${name} (https://github.com/UnwrittenFun/hapi-oauth, ${version})`, | ||
'Accept-Encoding': 'gzip,deflate', | ||
'User-Agent': `${info_1.name} (https://github.com/UnwrittenFun/hapi-oauth, ${info_1.version})`, | ||
}, | ||
@@ -56,0 +56,0 @@ compress: true, |
@@ -1,6 +0,6 @@ | ||
export * from "./discord"; | ||
export * from "./mixer"; | ||
export * from "./patreon"; | ||
export * from "./picarto"; | ||
export * from "./smashcast"; | ||
export * from "./twitch"; | ||
export * from './discord'; | ||
export * from './mixer'; | ||
export * from './patreon'; | ||
export * from './picarto'; | ||
export * from './smashcast'; | ||
export * from './twitch'; |
@@ -1,3 +0,3 @@ | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
export declare class MixerProfile implements Profile { | ||
@@ -4,0 +4,0 @@ id: number; |
@@ -20,6 +20,6 @@ "use strict"; | ||
this.scopes = scopes; | ||
this.name = "mixer"; | ||
this.tokenUrl = "https://mixer.com/api/v1/oauth/token"; | ||
this.authUrl = "https://mixer.com/oauth/authorize"; | ||
this.profileUrl = "https://mixer.com/api/v1/users/current"; | ||
this.name = 'mixer'; | ||
this.tokenUrl = 'https://mixer.com/api/v1/oauth/token'; | ||
this.authUrl = 'https://mixer.com/oauth/authorize'; | ||
this.profileUrl = 'https://mixer.com/api/v1/users/current'; | ||
} | ||
@@ -26,0 +26,0 @@ getProfile(tokens) { |
@@ -1,2 +0,2 @@ | ||
import { Provider, Scopes } from "../provider"; | ||
import { Provider, Scopes } from '../provider'; | ||
export declare class PatreonProvider extends Provider { | ||
@@ -3,0 +3,0 @@ clientId: string; |
@@ -12,5 +12,5 @@ "use strict"; | ||
this.scopes = scopes; | ||
this.name = "patreon"; | ||
this.tokenUrl = "https://api.patreon.com/oauth2/token"; | ||
this.authUrl = "https://www.patreon.com/oauth2/authorize"; | ||
this.name = 'patreon'; | ||
this.tokenUrl = 'https://api.patreon.com/oauth2/token'; | ||
this.authUrl = 'https://www.patreon.com/oauth2/authorize'; | ||
} | ||
@@ -24,3 +24,3 @@ requestToken(code, redirect_uri) { | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}; | ||
@@ -27,0 +27,0 @@ Wreck.post(`${this.tokenUrl}?${qs.stringify(query)}`, { |
@@ -1,3 +0,3 @@ | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
export declare class PicartoProfile implements Profile { | ||
@@ -4,0 +4,0 @@ channel_details: { |
@@ -22,6 +22,6 @@ "use strict"; | ||
this.scopes = scopes; | ||
this.name = "picarto"; | ||
this.tokenUrl = "https://oauth.picarto.tv/token"; | ||
this.authUrl = "https://oauth.picarto.tv/authorize"; | ||
this.profileUrl = "https://api.picarto.tv/v1/user"; | ||
this.name = 'picarto'; | ||
this.tokenUrl = 'https://oauth.picarto.tv/token'; | ||
this.authUrl = 'https://oauth.picarto.tv/authorize'; | ||
this.profileUrl = 'https://api.picarto.tv/v1/user'; | ||
} | ||
@@ -35,3 +35,3 @@ requestToken(code, redirect_uri) { | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}; | ||
@@ -38,0 +38,0 @@ Wreck.post(`${this.tokenUrl}?${qs.stringify(query)}`, { |
@@ -1,4 +0,4 @@ | ||
import * as Hapi from "hapi"; | ||
import { Provider } from "../provider"; | ||
import { PluginOptions } from "../plugin"; | ||
import * as Hapi from 'hapi'; | ||
import { Provider } from '../provider'; | ||
import { PluginOptions } from '../plugin'; | ||
export declare class SmashcastProvider extends Provider { | ||
@@ -5,0 +5,0 @@ clientId: string; |
@@ -11,6 +11,6 @@ "use strict"; | ||
this.clientSecret = clientSecret; | ||
this.name = "smashcast"; | ||
this.tokenUrl = "https://api.smashcast.tv/oauth/exchange"; | ||
this.authUrl = "https://api.smashcast.tv/oauth/login"; | ||
this.hash = new Buffer(`${clientId} ${clientSecret}`).toString("base64"); | ||
this.name = 'smashcast'; | ||
this.tokenUrl = 'https://api.smashcast.tv/oauth/exchange'; | ||
this.authUrl = 'https://api.smashcast.tv/oauth/login'; | ||
this.hash = new Buffer(`${clientId} ${clientSecret}`).toString('base64'); | ||
} | ||
@@ -26,3 +26,3 @@ compileAuthUrl(req, options, redirectUri) { | ||
extractCode(req) { | ||
return req.query["request_token"]; | ||
return req.query['request_token']; | ||
} | ||
@@ -44,3 +44,3 @@ requestToken(code, redirect_uri) { | ||
if (res instanceof Buffer) { | ||
res = res.toString("utf8"); | ||
res = res.toString('utf8'); | ||
try { | ||
@@ -65,5 +65,5 @@ res = JSON.parse(res); | ||
handleCode(request, options, redirectUri) { | ||
if (request.query["authToken"]) { | ||
if (request.query['authToken']) { | ||
const data = { | ||
access_token: request.query["authToken"], | ||
access_token: request.query['authToken'], | ||
}; | ||
@@ -70,0 +70,0 @@ return options.handler.onLink({ provider: this, data }, request); |
@@ -1,3 +0,3 @@ | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
export declare class TwitchProfile implements Profile { | ||
@@ -4,0 +4,0 @@ _id: string; |
@@ -20,6 +20,6 @@ "use strict"; | ||
this.scopes = scopes; | ||
this.name = "twitch"; | ||
this.tokenUrl = "https://api.twitch.tv/kraken/oauth2/token"; | ||
this.authUrl = "https://api.twitch.tv/kraken/oauth2/authorize"; | ||
this.profileUrl = "https://api.twitch.tv/kraken/user"; | ||
this.name = 'twitch'; | ||
this.tokenUrl = 'https://api.twitch.tv/kraken/oauth2/token'; | ||
this.authUrl = 'https://api.twitch.tv/kraken/oauth2/authorize'; | ||
this.profileUrl = 'https://api.twitch.tv/kraken/user'; | ||
} | ||
@@ -29,4 +29,4 @@ getProfile(tokens) { | ||
headers: { | ||
Accept: "application/vnd.twitchtv.v5+json", | ||
"Client-ID": this.clientId, | ||
Accept: 'application/vnd.twitchtv.v5+json', | ||
'Client-ID': this.clientId, | ||
Authorization: `OAuth ${tokens.access_token}`, | ||
@@ -33,0 +33,0 @@ }, |
{ | ||
"name": "hapi-oauth", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"description": "Hapi oauth plugin", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,5 +0,5 @@ | ||
import * as Boom from "boom"; | ||
import { Request } from "hapi"; | ||
import * as Boom from 'boom'; | ||
import { Request } from 'hapi'; | ||
import { Provider } from "./provider"; | ||
import { Provider } from './provider'; | ||
@@ -6,0 +6,0 @@ export interface LinkSuccess { |
@@ -1,8 +0,7 @@ | ||
import * as Hapi from "hapi"; | ||
import * as Hapi from 'hapi'; | ||
import { OAuthHandler } from "./handler"; | ||
import { Provider, registerProvider } from "./provider"; | ||
import { OAuthHandler } from './handler'; | ||
import { Provider, registerProvider } from './provider'; | ||
import { name, version } from './info'; | ||
const pkg = require('../package.json'); | ||
export interface PluginOptions { | ||
@@ -18,7 +17,7 @@ // onLink: (err: any, payload: any, request: Hapi.Request, reply: Hapi.IReply) => void; | ||
export const plugin: Hapi.Plugin<PluginOptions> = { | ||
name: pkg.name, | ||
version: pkg.version, | ||
name, | ||
version, | ||
async register(server, options) { | ||
if (!options.providers) { | ||
throw new Error("Providers array not supplied"); | ||
throw new Error('Providers array not supplied'); | ||
} | ||
@@ -25,0 +24,0 @@ |
@@ -1,8 +0,8 @@ | ||
import * as Hapi from "hapi"; | ||
import * as qs from "querystring"; | ||
import * as Boom from "boom"; | ||
import * as Wreck from "wreck"; | ||
import * as Hapi from 'hapi'; | ||
import * as qs from 'querystring'; | ||
import * as Boom from 'boom'; | ||
import * as Wreck from 'wreck'; | ||
import { PluginOptions } from "./plugin"; | ||
import { Profile } from "./profile"; | ||
import { PluginOptions } from './plugin'; | ||
import { Profile } from './profile'; | ||
@@ -30,7 +30,7 @@ export type Scopes = | ||
return this.getScopes(req).join(" "); | ||
return this.getScopes(req).join(' '); | ||
} | ||
getScopes(req: Hapi.Request): string[] { | ||
if (typeof this.scopes === "function") { | ||
if (typeof this.scopes === 'function') { | ||
return this.scopes(this.name, req); | ||
@@ -48,3 +48,3 @@ } | ||
const query = { | ||
response_type: "code", | ||
response_type: 'code', | ||
redirect_uri: redirectUri, | ||
@@ -56,3 +56,3 @@ client_id: this.clientId, | ||
if (scopes) { | ||
query["scope"] = scopes; | ||
query['scope'] = scopes; | ||
} | ||
@@ -76,3 +76,3 @@ | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}, | ||
@@ -102,3 +102,3 @@ }, | ||
extractCode(req: Hapi.Request) { | ||
return req.query["code"]; | ||
return req.query['code']; | ||
} | ||
@@ -114,3 +114,3 @@ | ||
if (!code) { | ||
throw Boom.unauthorized("Missing code"); | ||
throw Boom.unauthorized('Missing code'); | ||
} | ||
@@ -126,3 +126,3 @@ | ||
/*abstract*/ getProfile(tokens: AccessTokens): Promise<Profile> { | ||
throw new Error("Not implemented"); | ||
throw new Error('Not implemented'); | ||
} | ||
@@ -139,3 +139,3 @@ } | ||
server.route({ | ||
method: "GET", | ||
method: 'GET', | ||
path: `/oauth/${provider.name}/request`, | ||
@@ -151,3 +151,3 @@ options: options.requestConfig, | ||
server.route({ | ||
method: "GET", | ||
method: 'GET', | ||
path: `/oauth/${provider.name}`, | ||
@@ -154,0 +154,0 @@ options: options.linkConfig, |
@@ -1,9 +0,8 @@ | ||
const { name, version } = require("../../../package.json"); | ||
import fetch from 'node-fetch'; | ||
import { stringify } from 'querystring'; | ||
import fetch from "node-fetch"; | ||
import { stringify } from "querystring"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
import { name, version } from '../info'; | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
export class DiscordProfile implements Profile { | ||
@@ -29,6 +28,6 @@ public id: string; | ||
export class DiscordProvider extends Provider { | ||
public name = "discord"; | ||
public tokenUrl = "https://discordapp.com/api/oauth2/token"; | ||
public authUrl = "https://discordapp.com/api/oauth2/authorize"; | ||
public profileUrl = "https://discordapp.com/api/users/@me"; | ||
public name = 'discord'; | ||
public tokenUrl = 'https://discordapp.com/api/oauth2/token'; | ||
public authUrl = 'https://discordapp.com/api/oauth2/authorize'; | ||
public profileUrl = 'https://discordapp.com/api/users/@me'; | ||
@@ -45,6 +44,6 @@ constructor( | ||
return fetch(this.tokenUrl, { | ||
method: "POST", | ||
method: 'POST', | ||
headers: { | ||
"Accept-Encoding": "gzip,deflate", | ||
"Content-Type": "application/x-www-form-urlencoded", | ||
'Accept-Encoding': 'gzip,deflate', | ||
'Content-Type': 'application/x-www-form-urlencoded', | ||
}, | ||
@@ -56,3 +55,3 @@ body: stringify({ | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}), | ||
@@ -69,4 +68,4 @@ compress: true, | ||
Authorization: `Bearer ${tokens.access_token}`, | ||
"Accept-Encoding": "gzip,deflate", | ||
"User-Agent": `${name} (https://github.com/UnwrittenFun/hapi-oauth, ${version})`, | ||
'Accept-Encoding': 'gzip,deflate', | ||
'User-Agent': `${name} (https://github.com/UnwrittenFun/hapi-oauth, ${version})`, | ||
}, | ||
@@ -73,0 +72,0 @@ compress: true, |
@@ -1,6 +0,6 @@ | ||
export * from "./discord"; | ||
export * from "./mixer"; | ||
export * from "./patreon"; | ||
export * from "./picarto"; | ||
export * from "./smashcast"; | ||
export * from "./twitch"; | ||
export * from './discord'; | ||
export * from './mixer'; | ||
export * from './patreon'; | ||
export * from './picarto'; | ||
export * from './smashcast'; | ||
export * from './twitch'; |
@@ -1,5 +0,5 @@ | ||
import fetch from "node-fetch"; | ||
import fetch from 'node-fetch'; | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
@@ -31,6 +31,6 @@ export class MixerProfile implements Profile { | ||
export class MixerProvider extends Provider { | ||
public name = "mixer"; | ||
public tokenUrl = "https://mixer.com/api/v1/oauth/token"; | ||
public authUrl = "https://mixer.com/oauth/authorize"; | ||
public profileUrl = "https://mixer.com/api/v1/users/current"; | ||
public name = 'mixer'; | ||
public tokenUrl = 'https://mixer.com/api/v1/oauth/token'; | ||
public authUrl = 'https://mixer.com/oauth/authorize'; | ||
public profileUrl = 'https://mixer.com/api/v1/users/current'; | ||
@@ -37,0 +37,0 @@ constructor( |
@@ -1,10 +0,10 @@ | ||
import * as Wreck from "wreck"; | ||
import * as qs from "querystring"; | ||
import * as Wreck from 'wreck'; | ||
import * as qs from 'querystring'; | ||
import { Provider, Scopes } from "../provider"; | ||
import { Provider, Scopes } from '../provider'; | ||
export class PatreonProvider extends Provider { | ||
public name = "patreon"; | ||
public tokenUrl = "https://api.patreon.com/oauth2/token"; | ||
public authUrl = "https://www.patreon.com/oauth2/authorize"; | ||
public name = 'patreon'; | ||
public tokenUrl = 'https://api.patreon.com/oauth2/token'; | ||
public authUrl = 'https://www.patreon.com/oauth2/authorize'; | ||
@@ -26,3 +26,3 @@ constructor( | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}; | ||
@@ -29,0 +29,0 @@ Wreck.post( |
@@ -1,7 +0,7 @@ | ||
import * as Wreck from "wreck"; | ||
import * as qs from "querystring"; | ||
import fetch from "node-fetch"; | ||
import * as Wreck from 'wreck'; | ||
import * as qs from 'querystring'; | ||
import fetch from 'node-fetch'; | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
@@ -51,6 +51,6 @@ export class PicartoProfile implements Profile { | ||
export class PicartoProvider extends Provider { | ||
public name = "picarto"; | ||
public tokenUrl = "https://oauth.picarto.tv/token"; | ||
public authUrl = "https://oauth.picarto.tv/authorize"; | ||
public profileUrl = "https://api.picarto.tv/v1/user"; | ||
public name = 'picarto'; | ||
public tokenUrl = 'https://oauth.picarto.tv/token'; | ||
public authUrl = 'https://oauth.picarto.tv/authorize'; | ||
public profileUrl = 'https://api.picarto.tv/v1/user'; | ||
@@ -72,3 +72,3 @@ constructor( | ||
client_secret: this.clientSecret, | ||
grant_type: "authorization_code", | ||
grant_type: 'authorization_code', | ||
}; | ||
@@ -75,0 +75,0 @@ Wreck.post( |
@@ -1,13 +0,13 @@ | ||
import * as Hapi from "hapi"; | ||
import * as Boom from "boom"; | ||
import * as Wreck from "wreck"; | ||
import * as qs from "querystring"; | ||
import * as Hapi from 'hapi'; | ||
import * as Boom from 'boom'; | ||
import * as Wreck from 'wreck'; | ||
import * as qs from 'querystring'; | ||
import { Provider, Scopes } from "../provider"; | ||
import { PluginOptions } from "../plugin"; | ||
import { Provider, Scopes } from '../provider'; | ||
import { PluginOptions } from '../plugin'; | ||
export class SmashcastProvider extends Provider { | ||
public name = "smashcast"; | ||
public tokenUrl = "https://api.smashcast.tv/oauth/exchange"; | ||
public authUrl = "https://api.smashcast.tv/oauth/login"; | ||
public name = 'smashcast'; | ||
public tokenUrl = 'https://api.smashcast.tv/oauth/exchange'; | ||
public authUrl = 'https://api.smashcast.tv/oauth/login'; | ||
@@ -20,3 +20,3 @@ private hash: string; | ||
this.hash = new Buffer(`${clientId} ${clientSecret}`).toString( | ||
"base64", | ||
'base64', | ||
); | ||
@@ -40,3 +40,3 @@ } | ||
extractCode(req: Hapi.Request) { | ||
return req.query["request_token"]; | ||
return req.query['request_token']; | ||
} | ||
@@ -63,3 +63,3 @@ | ||
if (res instanceof Buffer) { | ||
res = res.toString("utf8"); | ||
res = res.toString('utf8'); | ||
try { | ||
@@ -91,5 +91,5 @@ res = JSON.parse(res); | ||
) { | ||
if (request.query["authToken"]) { | ||
if (request.query['authToken']) { | ||
const data = { | ||
access_token: request.query["authToken"], | ||
access_token: request.query['authToken'], | ||
}; | ||
@@ -96,0 +96,0 @@ |
@@ -1,4 +0,4 @@ | ||
import { Provider, Scopes, AccessTokens } from "../provider"; | ||
import { Profile } from "../profile"; | ||
import fetch from "node-fetch"; | ||
import { Provider, Scopes, AccessTokens } from '../provider'; | ||
import { Profile } from '../profile'; | ||
import fetch from 'node-fetch'; | ||
@@ -28,6 +28,6 @@ export class TwitchProfile implements Profile { | ||
export class TwitchProvider extends Provider { | ||
public name = "twitch"; | ||
public tokenUrl = "https://api.twitch.tv/kraken/oauth2/token"; | ||
public authUrl = "https://api.twitch.tv/kraken/oauth2/authorize"; | ||
public profileUrl = "https://api.twitch.tv/kraken/user"; | ||
public name = 'twitch'; | ||
public tokenUrl = 'https://api.twitch.tv/kraken/oauth2/token'; | ||
public authUrl = 'https://api.twitch.tv/kraken/oauth2/authorize'; | ||
public profileUrl = 'https://api.twitch.tv/kraken/user'; | ||
@@ -45,4 +45,4 @@ constructor( | ||
headers: { | ||
Accept: "application/vnd.twitchtv.v5+json", | ||
"Client-ID": this.clientId, | ||
Accept: 'application/vnd.twitchtv.v5+json', | ||
'Client-ID': this.clientId, | ||
Authorization: `OAuth ${tokens.access_token}`, | ||
@@ -49,0 +49,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
45564
43
1312
0