@octokit/oauth-app
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -68,3 +68,3 @@ 'use strict'; | ||
const VERSION = "3.7.0"; | ||
const VERSION = "3.7.1"; | ||
@@ -519,4 +519,4 @@ function addEventHandler(state, eventName, eventHandler) { | ||
if (!query.code) { | ||
throw new Error('[@octokit/oauth-app] "code" parameter is required'); | ||
if (!query.state || !query.code) { | ||
throw new Error('[@octokit/oauth-app] Both "code" & "state" parameters are required'); | ||
} | ||
@@ -529,2 +529,3 @@ | ||
} = await app.createToken({ | ||
state: query.state, | ||
code: query.code | ||
@@ -545,2 +546,3 @@ }); | ||
const { | ||
state: oauthState, | ||
code, | ||
@@ -550,7 +552,8 @@ redirectUrl | ||
if (!code) { | ||
throw new Error('[@octokit/oauth-app] "code" parameter is required'); | ||
if (!oauthState || !code) { | ||
throw new Error('[@octokit/oauth-app] Both "code" & "state" parameters are required'); | ||
} | ||
const result = await app.createToken({ | ||
state: oauthState, | ||
code, | ||
@@ -557,0 +560,0 @@ redirectUrl |
@@ -67,6 +67,7 @@ // @ts-ignore - requires esModuleInterop flag | ||
} | ||
if (!query.code) { | ||
throw new Error('[@octokit/oauth-app] "code" parameter is required'); | ||
if (!query.state || !query.code) { | ||
throw new Error('[@octokit/oauth-app] Both "code" & "state" parameters are required'); | ||
} | ||
const { authentication: { token }, } = await app.createToken({ | ||
state: query.state, | ||
code: query.code, | ||
@@ -85,7 +86,8 @@ }); | ||
if (route === routes.createToken) { | ||
const { code, redirectUrl } = json; | ||
if (!code) { | ||
throw new Error('[@octokit/oauth-app] "code" parameter is required'); | ||
const { state: oauthState, code, redirectUrl } = json; | ||
if (!oauthState || !code) { | ||
throw new Error('[@octokit/oauth-app] Both "code" & "state" parameters are required'); | ||
} | ||
const result = await app.createToken({ | ||
state: oauthState, | ||
code, | ||
@@ -92,0 +94,0 @@ redirectUrl, |
@@ -1,1 +0,1 @@ | ||
export const VERSION = "3.7.0"; | ||
export const VERSION = "3.7.1"; |
import { OAuthApp } from "../index"; | ||
import { HandlerOptions, OctokitRequest, OctokitResponse } from "./types"; | ||
import { OctokitRequest, OctokitResponse, HandlerOptions } from "./types"; | ||
import { ClientType, Options } from "../types"; | ||
export declare function handleRequest(app: OAuthApp<Options<ClientType>>, { pathPrefix }: HandlerOptions, request: OctokitRequest): Promise<OctokitResponse | null>; |
import { OAuthApp } from "../../index"; | ||
import { HandlerOptions } from "../types"; | ||
export declare function createWebWorkerHandler<T>(app: OAuthApp<T>, { pathPrefix, onUnhandledRequest, }?: HandlerOptions & { | ||
export declare function createWebWorkerHandler(app: OAuthApp, { pathPrefix, onUnhandledRequest, }?: HandlerOptions & { | ||
onUnhandledRequest?: (request: Request) => Response | Promise<Response>; | ||
@@ -5,0 +5,0 @@ }): (request: Request) => Promise<Response>; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "3.7.0"; | ||
export declare const VERSION = "3.7.1"; |
{ | ||
"name": "@octokit/oauth-app", | ||
"description": "GitHub OAuth toolset for Node.js", | ||
"version": "3.7.0", | ||
"version": "3.7.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "files": [ |
@@ -34,2 +34,4 @@ # oauth-app.js | ||
- [`createNodeMiddleware(app, options)`](#createnodemiddlewareapp-options) | ||
- [`createWebWorkerHandler(app, options)`](#createwebworkerhandlerapp-options) | ||
- [`createAWSLambdaAPIGatewayV2Handler(app, options)`](#createawslambdaapigatewayv2handlerapp-options) | ||
- [Contributing](#contributing) | ||
@@ -446,2 +448,3 @@ - [License](#license) | ||
const { token } = await app.createToken({ | ||
state: "state123", | ||
code: "code123", | ||
@@ -448,0 +451,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
160850
1850
1156