@octokit/oauth-authorization-url
Advanced tools
Comparing version 5.0.0 to 6.0.0
@@ -17,3 +17,2 @@ 'use strict'; | ||
}; | ||
if (clientType === "oauth-app") { | ||
@@ -23,7 +22,5 @@ const scopes = "scopes" in options ? options.scopes : []; | ||
} | ||
result.url = urlBuilderAuthorize(`${baseUrl}/login/oauth/authorize`, result); | ||
return result; | ||
} | ||
function urlBuilderAuthorize(base, options) { | ||
@@ -39,4 +36,6 @@ const map = { | ||
let url = base; | ||
Object.keys(map) // Filter out keys that are null and remove the url key | ||
.filter(k => options[k] !== null) // Filter out empty scopes array | ||
Object.keys(map) | ||
// Filter out keys that are null and remove the url key | ||
.filter(k => options[k] !== null) | ||
// Filter out empty scopes array | ||
.filter(k => { | ||
@@ -46,5 +45,7 @@ if (k !== "scopes") return true; | ||
return !Array.isArray(options[k]) || options[k].length > 0; | ||
}) // Map Array with the proper URL parameter names and change the value to a string using template strings | ||
}) | ||
// Map Array with the proper URL parameter names and change the value to a string using template strings | ||
// @ts-ignore | ||
.map(key => [map[key], `${options[key]}`]) // Finally, build the URL | ||
.map(key => [map[key], `${options[key]}`]) | ||
// Finally, build the URL | ||
.forEach(([key, value], index) => { | ||
@@ -51,0 +52,0 @@ url += index === 0 ? `?` : "&"; |
{ | ||
"name": "@octokit/oauth-authorization-url", | ||
"description": "Universal library to retrieve GitHubâs identity URL for the OAuth web flow", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"license": "MIT", | ||
@@ -10,2 +10,7 @@ "files": [ | ||
], | ||
"source": "dist-src/index.js", | ||
"types": "dist-types/index.d.ts", | ||
"main": "dist-node/index.js", | ||
"module": "dist-web/index.js", | ||
"unpkg": "dist-web/index.js", | ||
"pika": true, | ||
@@ -21,23 +26,19 @@ "sideEffects": false, | ||
"devDependencies": { | ||
"@pika/pack": "^0.5.0", | ||
"@pika/pack": "^0.3.7", | ||
"@pika/plugin-build-node": "^0.9.0", | ||
"@pika/plugin-build-web": "^0.9.0", | ||
"@pika/plugin-ts-standard-pkg": "^0.9.0", | ||
"@types/jest": "^27.0.0", | ||
"jest": "^27.0.0", | ||
"@types/jest": "^29.0.0", | ||
"jest": "^29.0.0", | ||
"pika-plugin-unpkg-field": "^1.0.1", | ||
"ts-jest": "^27.0.0-next.12", | ||
"typescript": "^4.0.2" | ||
"prettier": "2.8.8", | ||
"ts-jest": "^29.0.0", | ||
"typescript": "^5.0.0" | ||
}, | ||
"engines": { | ||
"node": ">= 14" | ||
"node": ">= 18" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"source": "dist-src/index.js", | ||
"types": "dist-types/index.d.ts", | ||
"main": "dist-node/index.js", | ||
"module": "dist-web/index.js", | ||
"unpkg": "dist-web/index.js" | ||
} | ||
} |
@@ -6,3 +6,3 @@ # oauth-authorization-url.js | ||
[![@latest](https://img.shields.io/npm/v/@octokit/oauth-authorization-url.svg)](https://www.npmjs.com/package/@octokit/oauth-authorization-url) | ||
[![Build Status](https://github.com/octokit/oauth-authorization-url.js/workflows/Test/badge.svg)](https://github.com/octokit/oauth-authorization-url.js/actions?query=workflow%3ATest+branch%3Amaster) | ||
[![Build Status](https://github.com/octokit/oauth-authorization-url.js/workflows/Test/badge.svg)](https://github.com/octokit/oauth-authorization-url.js/actions?query=workflow%3ATest+branch%3Amain) | ||
@@ -32,3 +32,3 @@ See [GitHub’s Developer Guide for the OAuth App web application flow](https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). Note that the [OAuth web application flow for GitHub Apps](https://docs.github.com/en/developers/apps/identifying-and-authorizing-users-for-github-apps#web-application-flow) is slightly different. GitHub Apps do not support scopes for its user access tokens (they are called user-to-server tokens for GitHub Apps), instead they inherit the user permissions from the GitHub App's registration and the repository/organization access and permissions from the respective installation. | ||
<td width=100%> | ||
Load `@octokit/oauth-authorization-url` directly from [cdn.skypack.dev](https://cdn.skypack.dev) | ||
@@ -63,17 +63,11 @@ | ||
```js | ||
const { | ||
url, | ||
clientId, | ||
redirectUrl, | ||
login, | ||
scopes, | ||
state, | ||
} = oauthAuthorizationUrl({ | ||
clientType: "oauth-app", | ||
clientId: "1234567890abcdef1234", | ||
redirectUrl: "https://example.com", | ||
login: "octocat", | ||
scopes: ["repo", "admin:org"], | ||
state: "secret123", | ||
}); | ||
const { url, clientId, redirectUrl, login, scopes, state } = | ||
oauthAuthorizationUrl({ | ||
clientType: "oauth-app", | ||
clientId: "1234567890abcdef1234", | ||
redirectUrl: "https://example.com", | ||
login: "octocat", | ||
scopes: ["repo", "admin:org"], | ||
state: "secret123", | ||
}); | ||
``` | ||
@@ -169,3 +163,3 @@ | ||
<td> | ||
Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. Use <code>false</code> in the case that a policy prohibits signups. Defaults to <code>true</code>. | ||
Whether or not unauthenticated users will be offered an option to sign up for GitHub during the OAuth flow. Use <code>false</code> in the case that a policy prohibits signups. Defaults to <code>true</code>. | ||
</td> | ||
@@ -172,0 +166,0 @@ </tr> |
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
11352
10
4
52
276