Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions packages/oauth-providers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,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'],
})
)
Expand All @@ -55,8 +55,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) => {
Expand All @@ -75,6 +75,8 @@ app.get(
export default app
```

If you are using Bun, replace `process.env` to `Bun.env` to resolve Environments at runtime.

### Google

```ts
Expand All @@ -86,8 +88,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'],
})
)
Expand Down Expand Up @@ -198,8 +200,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',
Expand Down Expand Up @@ -410,8 +412,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,
})
)

Expand Down Expand Up @@ -439,8 +441,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,
})
Expand Down Expand Up @@ -543,8 +545,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'],
})
)
Expand Down Expand Up @@ -573,8 +575,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,
})
)
Expand Down Expand Up @@ -627,8 +629,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'],
})
Expand Down Expand Up @@ -784,8 +786,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'],
})
)
Expand Down