pull/612/merge
yuta.suzuki 2025-06-16 12:42:11 +10:00 committed by GitHub
commit 193702f802
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 22 additions and 20 deletions

View File

@ -30,8 +30,8 @@ Also, there is two ways to use this middleware:
app.use(
'/google',
googleAuth({
client_id: Bun.env.GOOGLE_ID,
client_secret: Bun.env.GOOGLE_SECRET,
client_id: process.env.GOOGLE_ID,
client_secret: process.env.GOOGLE_SECRET,
scope: ['openid', 'email', 'profile'],
})
)
@ -57,8 +57,8 @@ Or
app.get(
'/google',
googleAuth({
client_id: Bun.env.GOOGLE_ID,
client_secret: Bun.env.GOOGLE_SECRET,
client_id: process.env.GOOGLE_ID,
client_secret: process.env.GOOGLE_SECRET,
scope: ['openid', 'email', 'profile'],
}),
(c) => {
@ -77,6 +77,8 @@ app.get(
export default app
```
If you are using Bun, replace `process.env` to `Bun.env` to resolve Environments at runtime.
### Google
```ts
@ -88,8 +90,8 @@ const app = new Hono()
app.use(
'/google',
googleAuth({
client_id: Bun.env.GOOGLE_ID,
client_secret: Bun.env.GOOGLE_SECRET,
client_id: process.env.GOOGLE_ID,
client_secret: process.env.GOOGLE_SECRET,
scope: ['openid', 'email', 'profile'],
})
)
@ -200,8 +202,8 @@ const app = new Hono()
app.use(
'/facebook',
facebookAuth({
client_id: Bun.env.FACEBOOK_ID,
client_secret: Bun.env.FACEBOOK_SECRET,
client_id: process.env.FACEBOOK_ID,
client_secret: process.env.FACEBOOK_SECRET,
scope: ['email', 'public_profile'],
fields: [
'email',
@ -412,8 +414,8 @@ const app = new Hono()
app.use(
'/github',
githubAuth({
client_id: Bun.env.GITHUB_ID,
client_secret: Bun.env.GITHUB_SECRET,
client_id: process.env.GITHUB_ID,
client_secret: process.env.GITHUB_SECRET,
})
)
@ -441,8 +443,8 @@ const app = new Hono()
app.use(
'/github',
githubAuth({
client_id: Bun.env.GITHUB_ID,
client_secret: Bun.env.GITHUB_SECRET,
client_id: process.env.GITHUB_ID,
client_secret: process.env.GITHUB_SECRET,
scope: ['public_repo', 'read:user', 'user', 'user:email', 'user:follow'],
oauthApp: true,
})
@ -545,8 +547,8 @@ const app = new Hono()
app.use(
'/linkedin',
linkedinAuth({
client_id: Bun.env.LINKEDIN_ID,
client_secret: Bun.env.LINKEDIN_SECRET,
client_id: process.env.LINKEDIN_ID,
client_secret: process.env.LINKEDIN_SECRET,
scope: ['email', 'openid', 'profile'],
})
)
@ -575,8 +577,8 @@ const app = new Hono()
app.use(
'/linkedin',
linkedinAuth({
client_id: Bun.env.LINKEDIN_ID,
client_secret: Bun.env.LINKEDIN_SECRET,
client_id: process.env.LINKEDIN_ID,
client_secret: process.env.LINKEDIN_SECRET,
appAuth: true,
})
)
@ -629,8 +631,8 @@ const app = new Hono()
app.use(
'/x',
xAuth({
client_id: Bun.env.X_ID,
client_secret: Bun.env.X_SECRET,
client_id: process.env.X_ID,
client_secret: process.env.X_SECRET,
scope: ['tweet.read', 'users.read', 'offline.access'],
fields: ['profile_image_url', 'url'],
})
@ -786,8 +788,8 @@ const app = new Hono()
app.use(
'/discord',
discordAuth({
client_id: Bun.env.DISCORD_ID,
client_secret: Bun.env.DISCORD_SECRET,
client_id: process.env.DISCORD_ID,
client_secret: process.env.DISCORD_SECRET,
scope: ['identify', 'email'],
})
)