Compare commits

...

3 Commits

Author SHA1 Message Date
Nhat Bui b3b920c0f6
Merge 437426cfc4 into 0debb59474 2025-05-02 15:04:12 +07:00
Shotaro Nakamura 0debb59474
ci: add codestyle ci (#1149) 2025-05-02 16:51:42 +09:00
buiducnhat 437426cfc4 feat(oauth-providers): availbility pass state into middlewares 2024-12-30 23:14:40 +07:00
6 changed files with 31 additions and 4 deletions

View File

@ -0,0 +1,5 @@
---
'@hono/oauth-providers': minor
---
Add availbility to pass parameter state into OAuth middlewares

18
.github/workflows/codestyle.yml vendored 100644
View File

@ -0,0 +1,18 @@
name: codestyle
on:
push:
branches: [main]
pull_request:
branches: ['*']
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20.x
- run: yarn
- run: yarn format
- run: yarn lint

View File

@ -12,10 +12,11 @@ export function facebookAuth(options: {
fields: Fields[]
client_id?: string
client_secret?: string
state?: string
redirect_uri?: string
}): MiddlewareHandler {
return async (c, next) => {
const newState = getRandomState()
const newState = options.state || getRandomState()
// Create new Auth instance
const auth = new AuthFlow({
client_id: options.client_id || (env(c).FACEBOOK_ID as string),

View File

@ -12,10 +12,11 @@ export function githubAuth(options: {
client_secret?: string
scope?: GitHubScope[]
oauthApp?: boolean
state?: string
redirect_uri?: string
}): MiddlewareHandler {
return async (c, next) => {
const newState = getRandomState()
const newState = options.state || getRandomState()
// Create new Auth instance
const auth = new AuthFlow({
client_id: options.client_id || (env(c).GITHUB_ID as string),

View File

@ -12,10 +12,11 @@ export function linkedinAuth(options: {
client_secret?: string
scope?: LinkedInScope[]
appAuth?: boolean
state?: string
redirect_uri?: string
}): MiddlewareHandler {
return async (c, next) => {
const newState = getRandomState()
const newState = options.state || getRandomState()
// Create new Auth instance
const auth = new AuthFlow({
client_id: options.client_id || (env(c).LINKEDIN_ID as string),

View File

@ -13,11 +13,12 @@ export function xAuth(options: {
fields?: XFields[]
client_id?: string
client_secret?: string
state?: string
redirect_uri?: string
}): MiddlewareHandler {
return async (c, next) => {
// Generate encoded "keys"
const newState = getRandomState()
const newState = options.state || getRandomState()
const challenge = await getCodeChallenge()
const auth = new AuthFlow({