This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
73957b7
commit e51f70a
Showing
2 changed files
with
26 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,37 @@ | ||
import type { VercelRequest, VercelResponse } from '@vercel/node'; | ||
|
||
const grant = require('grant').vercel({ | ||
config: grantConfig(), session: {secret: 'grant'} | ||
}); | ||
|
||
function grantConfig() { | ||
const config = require('./config/grant.json'); | ||
const config = { | ||
"defaults": { | ||
// "origin": "https://docs.crab.network", | ||
"origin": "https://crab-docs-dev.vercel.app", | ||
"transport": "querystring", | ||
"state": true | ||
}, | ||
"github": { | ||
"key": "{{ github_oauth_app_key }}", | ||
"secret": "{{ github_oauth_app_secret }}", | ||
"scope": [], | ||
"callback": "/api/crab/authorization", | ||
"overrides": { | ||
"crab": { | ||
"callback": "/api/crab/authorization" | ||
}, | ||
"pangolin": { | ||
"callback": "/api/pangolin/authorization" | ||
} | ||
} | ||
} | ||
}; | ||
config.github.key = process.env.GITHUB_OAUTH_APP_KEY; | ||
config.github.secret = process.env.GITHUB_OAUTH_APP_SECRET; | ||
return config; | ||
} | ||
|
||
const grant = require('grant').vercel({ | ||
config: grantConfig(), session: {secret: 'grant'} | ||
}); | ||
|
||
export default async function (req: VercelRequest, res: VercelResponse) { | ||
await grant(req, res) | ||
} |