@substrate/playground-client
Advanced tools
Comparing version 1.3.8 to 1.3.9
@@ -10,5 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
export function getVerification(githubClientId, scope = "user:read") { | ||
// Scope can be: https://docs.github.com/en/developers/apps/scopes-for-oauth-apps | ||
export function getVerification(githubClientId, scope = "read:user") { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const res = yield fetch(`https://github.com/login/device/code?client_id=${githubClientId}?scope=${scope}`, { | ||
const res = yield fetch(`https://github.com/login/device/code?client_id=${githubClientId}&scope=${scope}`, { | ||
method: 'POST', | ||
@@ -18,2 +19,8 @@ headers: { 'Accept': 'application/json' } | ||
const { device_code, user_code, verification_uri, expires_in, interval } = yield res.json(); | ||
// TODO handle errors | ||
/* | ||
{ error: 'invalid_scope', | ||
error_description: 'The scopes requested are invalid: user:read.', | ||
error_uri: 'https://docs.github.com' } | ||
*/ | ||
return { | ||
@@ -20,0 +27,0 @@ deviceCode: device_code, |
@@ -40,4 +40,5 @@ "use strict"; | ||
exports.getAuthorization = exports.getVerification = void 0; | ||
// Scope can be: https://docs.github.com/en/developers/apps/scopes-for-oauth-apps | ||
function getVerification(githubClientId, scope) { | ||
if (scope === void 0) { scope = "user:read"; } | ||
if (scope === void 0) { scope = "read:user"; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -47,3 +48,3 @@ var res, _a, device_code, user_code, verification_uri, expires_in, interval; | ||
switch (_b.label) { | ||
case 0: return [4 /*yield*/, fetch("https://github.com/login/device/code?client_id=" + githubClientId + "?scope=" + scope, { | ||
case 0: return [4 /*yield*/, fetch("https://github.com/login/device/code?client_id=" + githubClientId + "&scope=" + scope, { | ||
method: 'POST', | ||
@@ -57,2 +58,8 @@ headers: { 'Accept': 'application/json' } | ||
_a = _b.sent(), device_code = _a.device_code, user_code = _a.user_code, verification_uri = _a.verification_uri, expires_in = _a.expires_in, interval = _a.interval; | ||
// TODO handle errors | ||
/* | ||
{ error: 'invalid_scope', | ||
error_description: 'The scopes requested are invalid: user:read.', | ||
error_uri: 'https://docs.github.com' } | ||
*/ | ||
return [2 /*return*/, { | ||
@@ -59,0 +66,0 @@ deviceCode: device_code, |
{ | ||
"name": "@substrate/playground-client", | ||
"version": "1.3.8", | ||
"version": "1.3.9", | ||
"description": "An isomorphic client for Substrate Playground", | ||
@@ -5,0 +5,0 @@ "main": "dist/main/index.js", |
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
50688
1110