Socket
Socket
Sign inDemoInstall

@octokit/oauth-app

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/oauth-app - npm Package Compare versions

Comparing version 2.0.3 to 2.0.4

6

dist-node/index.js

@@ -16,3 +16,3 @@ 'use strict';

const VERSION = "2.0.3";
const VERSION = "2.0.4";

@@ -131,3 +131,3 @@ function addEventHandler(state, eventName, eventHandler) {

function getAuthorizationUrlWithState(state, options) {
return getAuthorizationUrl(_objectSpread2({}, options, {
return getAuthorizationUrl(_objectSpread2(_objectSpread2({}, options), {}, {
clientId: options.clientId || state.clientId,

@@ -258,3 +258,3 @@ allowSignup: options.allowSignup || state.allowSignup,

token: result.token,
scopes: result.scopes,
scopes: result.scopes || undefined,

@@ -261,0 +261,0 @@ get octokit() {

@@ -28,3 +28,3 @@ import { request as defaultRequest } from "@octokit/request";

token: result.token,
scopes: result.scopes,
scopes: result.scopes || undefined,
get octokit() {

@@ -31,0 +31,0 @@ return new state.Octokit({

@@ -1,1 +0,1 @@

export const VERSION = "2.0.3";
export const VERSION = "2.0.4";

@@ -10,5 +10,201 @@ import { State } from "../types";

};
export declare function checkToken(options: Options): Promise<any>;
export declare function checkTokenWithState(state: State, options: StateOptions): Promise<any>;
export declare function checkToken(options: Options): Promise<{
id: number;
url: string;
scopes: string[] | null;
token: string;
token_last_eight: string | null;
hashed_token: string | null;
app: {
client_id: string;
name: string;
url: string;
};
note: string | null;
note_url: string | null;
updated_at: string;
created_at: string;
fingerprint: string | null;
user?: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null | undefined;
installation?: {
permissions: {
actions?: "read" | "write" | undefined;
administration?: "read" | "write" | undefined;
checks?: "read" | "write" | undefined;
content_references?: "read" | "write" | undefined;
contents?: "read" | "write" | undefined;
deployments?: "read" | "write" | undefined;
environments?: "read" | "write" | undefined;
issues?: "read" | "write" | undefined;
metadata?: "read" | "write" | undefined;
packages?: "read" | "write" | undefined;
pages?: "read" | "write" | undefined;
pull_requests?: "read" | "write" | undefined;
repository_hooks?: "read" | "write" | undefined;
repository_projects?: "read" | "write" | "admin" | undefined;
secret_scanning_alerts?: "read" | "write" | undefined;
secrets?: "read" | "write" | undefined;
security_events?: "read" | "write" | undefined;
single_file?: "read" | "write" | undefined;
statuses?: "read" | "write" | undefined;
vulnerability_alerts?: "read" | undefined;
workflows?: "write" | undefined;
members?: "read" | "write" | undefined;
organization_administration?: "read" | "write" | undefined;
organization_hooks?: "read" | "write" | undefined;
organization_plan?: "read" | undefined;
organization_projects?: "read" | "write" | "admin" | undefined;
organization_secrets?: "read" | "write" | undefined;
organization_self_hosted_runners?: "read" | "write" | undefined;
organization_user_blocking?: "read" | "write" | undefined;
team_discussions?: "read" | "write" | undefined;
};
repository_selection: "all" | "selected";
single_file_name: string | null;
has_multiple_single_files?: boolean | undefined;
single_file_paths?: string[] | undefined;
repositories_url: string;
account: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
} | null | undefined;
}>;
export declare function checkTokenWithState(state: State, options: StateOptions): Promise<{
id: number;
url: string;
scopes: string[] | null;
token: string;
token_last_eight: string | null;
hashed_token: string | null;
app: {
client_id: string;
name: string;
url: string;
};
note: string | null;
note_url: string | null;
updated_at: string;
created_at: string;
fingerprint: string | null;
user?: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null | undefined;
installation?: {
permissions: {
actions?: "read" | "write" | undefined;
administration?: "read" | "write" | undefined;
checks?: "read" | "write" | undefined;
content_references?: "read" | "write" | undefined;
contents?: "read" | "write" | undefined;
deployments?: "read" | "write" | undefined;
environments?: "read" | "write" | undefined;
issues?: "read" | "write" | undefined;
metadata?: "read" | "write" | undefined;
packages?: "read" | "write" | undefined;
pages?: "read" | "write" | undefined;
pull_requests?: "read" | "write" | undefined;
repository_hooks?: "read" | "write" | undefined;
repository_projects?: "read" | "write" | "admin" | undefined;
secret_scanning_alerts?: "read" | "write" | undefined;
secrets?: "read" | "write" | undefined;
security_events?: "read" | "write" | undefined;
single_file?: "read" | "write" | undefined;
statuses?: "read" | "write" | undefined;
vulnerability_alerts?: "read" | undefined;
workflows?: "write" | undefined;
members?: "read" | "write" | undefined;
organization_administration?: "read" | "write" | undefined;
organization_hooks?: "read" | "write" | undefined;
organization_plan?: "read" | undefined;
organization_projects?: "read" | "write" | "admin" | undefined;
organization_secrets?: "read" | "write" | undefined;
organization_self_hosted_runners?: "read" | "write" | undefined;
organization_user_blocking?: "read" | "write" | undefined;
team_discussions?: "read" | "write" | undefined;
};
repository_selection: "all" | "selected";
single_file_name: string | null;
has_multiple_single_files?: boolean | undefined;
single_file_paths?: string[] | undefined;
repositories_url: string;
account: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
} | null | undefined;
}>;
export declare type AppCheckToken = (options: StateOptions) => ReturnType<typeof checkTokenWithState>;
export {};

@@ -10,5 +10,5 @@ import { State } from "../types";

};
export declare function deleteAuthorization(options: Options): Promise<any>;
export declare function deleteAuthorizationWithState(state: State, options: StateOptions): Promise<any>;
export declare function deleteAuthorization(options: Options): Promise<unknown>;
export declare function deleteAuthorizationWithState(state: State, options: StateOptions): Promise<unknown>;
export declare type AppDeleteAuthorization = (options: StateOptions) => ReturnType<typeof deleteAuthorizationWithState>;
export {};

@@ -10,5 +10,5 @@ import { State } from "../types";

};
export declare function deleteToken(options: Options): Promise<any>;
export declare function deleteTokenWithState(state: State, options: StateOptions): Promise<any>;
export declare function deleteToken(options: Options): Promise<unknown>;
export declare function deleteTokenWithState(state: State, options: StateOptions): Promise<unknown>;
export declare type AppDeleteToken = (options: StateOptions) => ReturnType<typeof deleteTokenWithState>;
export {};

@@ -10,5 +10,201 @@ import { State } from "../types";

};
export declare function resetToken(options: Options): Promise<any>;
export declare function resetTokenWithState(state: State, options: StateOptions): Promise<any>;
export declare function resetToken(options: Options): Promise<{
id: number;
url: string;
scopes: string[] | null;
token: string;
token_last_eight: string | null;
hashed_token: string | null;
app: {
client_id: string;
name: string;
url: string;
};
note: string | null;
note_url: string | null;
updated_at: string;
created_at: string;
fingerprint: string | null;
user?: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null | undefined;
installation?: {
permissions: {
actions?: "read" | "write" | undefined;
administration?: "read" | "write" | undefined;
checks?: "read" | "write" | undefined;
content_references?: "read" | "write" | undefined;
contents?: "read" | "write" | undefined;
deployments?: "read" | "write" | undefined;
environments?: "read" | "write" | undefined;
issues?: "read" | "write" | undefined;
metadata?: "read" | "write" | undefined;
packages?: "read" | "write" | undefined;
pages?: "read" | "write" | undefined;
pull_requests?: "read" | "write" | undefined;
repository_hooks?: "read" | "write" | undefined;
repository_projects?: "read" | "write" | "admin" | undefined;
secret_scanning_alerts?: "read" | "write" | undefined;
secrets?: "read" | "write" | undefined;
security_events?: "read" | "write" | undefined;
single_file?: "read" | "write" | undefined;
statuses?: "read" | "write" | undefined;
vulnerability_alerts?: "read" | undefined;
workflows?: "write" | undefined;
members?: "read" | "write" | undefined;
organization_administration?: "read" | "write" | undefined;
organization_hooks?: "read" | "write" | undefined;
organization_plan?: "read" | undefined;
organization_projects?: "read" | "write" | "admin" | undefined;
organization_secrets?: "read" | "write" | undefined;
organization_self_hosted_runners?: "read" | "write" | undefined;
organization_user_blocking?: "read" | "write" | undefined;
team_discussions?: "read" | "write" | undefined;
};
repository_selection: "all" | "selected";
single_file_name: string | null;
has_multiple_single_files?: boolean | undefined;
single_file_paths?: string[] | undefined;
repositories_url: string;
account: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
} | null | undefined;
}>;
export declare function resetTokenWithState(state: State, options: StateOptions): Promise<{
id: number;
url: string;
scopes: string[] | null;
token: string;
token_last_eight: string | null;
hashed_token: string | null;
app: {
client_id: string;
name: string;
url: string;
};
note: string | null;
note_url: string | null;
updated_at: string;
created_at: string;
fingerprint: string | null;
user?: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null | undefined;
installation?: {
permissions: {
actions?: "read" | "write" | undefined;
administration?: "read" | "write" | undefined;
checks?: "read" | "write" | undefined;
content_references?: "read" | "write" | undefined;
contents?: "read" | "write" | undefined;
deployments?: "read" | "write" | undefined;
environments?: "read" | "write" | undefined;
issues?: "read" | "write" | undefined;
metadata?: "read" | "write" | undefined;
packages?: "read" | "write" | undefined;
pages?: "read" | "write" | undefined;
pull_requests?: "read" | "write" | undefined;
repository_hooks?: "read" | "write" | undefined;
repository_projects?: "read" | "write" | "admin" | undefined;
secret_scanning_alerts?: "read" | "write" | undefined;
secrets?: "read" | "write" | undefined;
security_events?: "read" | "write" | undefined;
single_file?: "read" | "write" | undefined;
statuses?: "read" | "write" | undefined;
vulnerability_alerts?: "read" | undefined;
workflows?: "write" | undefined;
members?: "read" | "write" | undefined;
organization_administration?: "read" | "write" | undefined;
organization_hooks?: "read" | "write" | undefined;
organization_plan?: "read" | undefined;
organization_projects?: "read" | "write" | "admin" | undefined;
organization_secrets?: "read" | "write" | undefined;
organization_self_hosted_runners?: "read" | "write" | undefined;
organization_user_blocking?: "read" | "write" | undefined;
team_discussions?: "read" | "write" | undefined;
};
repository_selection: "all" | "selected";
single_file_name: string | null;
has_multiple_single_files?: boolean | undefined;
single_file_paths?: string[] | undefined;
repositories_url: string;
account: {
login: string;
id: number;
node_id: string;
avatar_url: string;
gravatar_id: string | null;
url: string;
html_url: string;
followers_url: string;
following_url: string;
gists_url: string;
starred_url: string;
subscriptions_url: string;
organizations_url: string;
repos_url: string;
events_url: string;
received_events_url: string;
type: string;
site_admin: boolean;
starred_at?: string | undefined;
} | null;
} | null | undefined;
}>;
export declare type AppResetToken = (options: StateOptions) => ReturnType<typeof resetTokenWithState>;
export {};

@@ -1,1 +0,1 @@

export declare const VERSION = "2.0.3";
export declare const VERSION = "2.0.4";
{
"name": "@octokit/oauth-app",
"description": "GitHub OAuth toolset for Node.js",
"version": "2.0.3",
"version": "2.0.4",
"license": "MIT",

@@ -6,0 +6,0 @@ "files": [

@@ -85,5 +85,5 @@ # oauth-app.js

- Node server with static files served from `public/` folder, hosted on Glitch: https://glitch.com/~github-oauth-client
- Serverless functions, hosted on [Zeit's now](https://zeit.co/): https://github.com/gr2m/octokit-oauth-app-now-example
- Serverless functions, hosted on AWS (via [begin.com](https://begin.com/)): https://github.com/gr2m/octokit-oauth-app-begin-example/
- Node server with static files served from `public/` folder, hosted on Glitch: <https://glitch.com/~github-oauth-client>
- Serverless functions, hosted on [Zeit's now](https://zeit.co/): <https://github.com/gr2m/octokit-oauth-app-now-example>
- Serverless functions, hosted on AWS (via [begin.com](https://begin.com/)): <https://github.com/gr2m/octokit-oauth-app-begin-example/>

@@ -149,3 +149,3 @@ ## Constructor options

Sets the default <code>scopes</code> value for <code>app.getAuthorizationUrl(options)</code>. See [available scopes](https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/#available-scopes)
Sets the default <code>scopes</code> value for <code>app.getAuthorizationUrl(options)</code>. See [available scopes](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes)

@@ -335,3 +335,3 @@ </td></tr>

<td>
The URL in your application where users will be sent after authorization. See <a href="https://developer.github.com/enterprise/2.16/apps/building-oauth-apps/authorizing-oauth-apps/#redirect-urls">Redirect URLs</a> in GitHub’s Developer Guide.
The URL in your application where users will be sent after authorization. See <a href="https://docs.github.com/en/developers/apps/authorizing-oauth-apps#redirect-urls">Redirect URLs</a> in GitHub’s Developer Guide.
</td>

@@ -523,3 +523,3 @@ </tr>

Resolves with response body from ["Check a token" request](https://developer.github.com/v3/apps/oauth_applications/#check-a-token).
Resolves with response body from ["Check a token" request](https://docs.github.com/en/rest/reference/apps#check-a-token).

@@ -564,3 +564,3 @@ ## `app.resetToken(options)`

Resolves with response body from ["Reset a token" request](https://developer.github.com/v3/apps/oauth_applications/#reset-a-token).
Resolves with response body from ["Reset a token" request](https://docs.github.com/en/rest/reference/apps#reset-a-token).

@@ -605,3 +605,3 @@ ## `app.deleteToken(options)`

Resolves with response body from ["Delete a token" request](https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-token).
Resolves with response body from ["Delete a token" request](https://docs.github.com/en/rest/reference/apps#delete-an-app-token).

@@ -646,3 +646,3 @@ ## `app.deleteAuthorization(options)`

Resolves with response body from ["Delete an app authorization" request](https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-authorization).
Resolves with response body from ["Delete an app authorization" request](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization).

@@ -722,3 +722,3 @@ ## Stateless methods

<td>
The URL in your application where users will be sent after authorization. See <a href="https://developer.github.com/enterprise/2.16/apps/building-oauth-apps/authorizing-oauth-apps/#redirect-urls">Redirect URLs</a> in GitHub’s Developer Guide.
The URL in your application where users will be sent after authorization. See <a href="https://docs.github.com/en/developers/apps/authorizing-oauth-apps#redirect-urls">Redirect URLs</a> in GitHub’s Developer Guide.
</td>

@@ -972,3 +972,3 @@ </tr>

Resolves with response body from ["Check a token" request](https://developer.github.com/v3/apps/oauth_applications/#check-a-token).
Resolves with response body from ["Check a token" request](https://docs.github.com/en/rest/reference/apps#check-a-token).

@@ -1038,3 +1038,3 @@ ### `resetToken(options)`

Resolves with response body from ["Reset a token" request](https://developer.github.com/v3/apps/oauth_applications/#reset-a-token).
Resolves with response body from ["Reset a token" request](https://docs.github.com/en/rest/reference/apps#reset-a-token).

@@ -1104,3 +1104,3 @@ ### `deleteToken(options)`

Resolves with response body from ["Delete a token" request](https://developer.github.com/v3/apps/oauth_applications/#delete-a-token).
Resolves with response body from ["Delete a token" request](https://docs.github.com/en/rest/reference/apps#delete-an-app-token).

@@ -1170,3 +1170,3 @@ ### `deleteAuthorization(options)`

Resolves with response body from ["Delete an app authorization" request](https://developer.github.com/v3/apps/oauth_applications/#delete-an-app-authorization).
Resolves with response body from ["Delete an app authorization" request](https://docs.github.com/en/rest/reference/apps#delete-an-app-authorization).

@@ -1179,11 +1179,11 @@ ## Middlewares

| Route | Route Description |
| -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /api/github/oauth/login` | Redirects to GitHub's authorization endpoint. Accepts optional `?state` and `?scopes` query parameters. `?scopes` is a comma-separated list of [supported OAuth scope names](https://developer.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/#available-scopes) |
| `GET /api/github/oauth/callback` | The client's redirect endpoint. This is where the `token` event gets triggered |
| `POST /api/github/oauth/token` | Exchange an authorization code for an OAuth Access token. If successful, the `token` event gets triggered. |
| `GET /api/github/oauth/token` | Check if token is valid. Must authenticate using token in `Authorization` header. Uses GitHub's [`POST /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#check-a-token) endpoint |
| `PATCH /api/github/oauth/token` | Resets a token (invalidates current one, returns new token). Must authenticate using token in `Authorization` header. Uses GitHub's [`PATCH /applications/{client_id}/token`](https://developer.github.com/v3/apps/oauth_applications/#reset-a-token) endpoint. |
| `DELETE /api/github/oauth/token` | Invalidates current token, basically the equivalent of a logout. Must authenticate using token in `Authorization` header. |
| `DELETE /api/github/oauth/grant` | Revokes the user's grant, basically the equivalent of an uninstall. must authenticate using token in `Authorization` header. |
| Route | Route Description |
| -------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET /api/github/oauth/login` | Redirects to GitHub's authorization endpoint. Accepts optional `?state` and `?scopes` query parameters. `?scopes` is a comma-separated list of [supported OAuth scope names](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps#available-scopes) |
| `GET /api/github/oauth/callback` | The client's redirect endpoint. This is where the `token` event gets triggered |
| `POST /api/github/oauth/token` | Exchange an authorization code for an OAuth Access token. If successful, the `token` event gets triggered. |
| `GET /api/github/oauth/token` | Check if token is valid. Must authenticate using token in `Authorization` header. Uses GitHub's [`POST /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#check-a-token) endpoint |
| `PATCH /api/github/oauth/token` | Resets a token (invalidates current one, returns new token). Must authenticate using token in `Authorization` header. Uses GitHub's [`PATCH /applications/{client_id}/token`](https://docs.github.com/en/rest/reference/apps#reset-a-token) endpoint. |
| `DELETE /api/github/oauth/token` | Invalidates current token, basically the equivalent of a logout. Must authenticate using token in `Authorization` header. |
| `DELETE /api/github/oauth/grant` | Revokes the user's grant, basically the equivalent of an uninstall. must authenticate using token in `Authorization` header. |

@@ -1190,0 +1190,0 @@ ### `getNodeMiddleware(app, options)`

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc