Merge f962d29eda
into 542391f8db
commit
61a44347cc
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'@hono/oauth-providers': minor
|
||||||
|
---
|
||||||
|
|
||||||
|
Optionally pass state as an option to oauth provider
|
|
@ -12,10 +12,11 @@ export function discordAuth(options: {
|
||||||
client_id?: string
|
client_id?: string
|
||||||
client_secret?: string
|
client_secret?: string
|
||||||
redirect_uri?: string
|
redirect_uri?: string
|
||||||
|
state?: string
|
||||||
}): MiddlewareHandler {
|
}): MiddlewareHandler {
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
// Generate encoded "keys"
|
// Generate encoded "keys"
|
||||||
const newState = getRandomState()
|
const newState = options.state || getRandomState()
|
||||||
|
|
||||||
// Create new Auth instance
|
// Create new Auth instance
|
||||||
const auth = new AuthFlow({
|
const auth = new AuthFlow({
|
||||||
|
|
|
@ -13,9 +13,10 @@ export function facebookAuth(options: {
|
||||||
client_id?: string
|
client_id?: string
|
||||||
client_secret?: string
|
client_secret?: string
|
||||||
redirect_uri?: string
|
redirect_uri?: string
|
||||||
|
state?: string
|
||||||
}): MiddlewareHandler {
|
}): MiddlewareHandler {
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
const newState = getRandomState()
|
const newState = options.state || getRandomState()
|
||||||
// Create new Auth instance
|
// Create new Auth instance
|
||||||
const auth = new AuthFlow({
|
const auth = new AuthFlow({
|
||||||
client_id: options.client_id || (env(c).FACEBOOK_ID as string),
|
client_id: options.client_id || (env(c).FACEBOOK_ID as string),
|
||||||
|
|
|
@ -13,9 +13,10 @@ export function githubAuth(options: {
|
||||||
scope?: GitHubScope[]
|
scope?: GitHubScope[]
|
||||||
oauthApp?: boolean
|
oauthApp?: boolean
|
||||||
redirect_uri?: string
|
redirect_uri?: string
|
||||||
|
state?: string
|
||||||
}): MiddlewareHandler {
|
}): MiddlewareHandler {
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
const newState = getRandomState()
|
const newState = options.state || getRandomState()
|
||||||
// Create new Auth instance
|
// Create new Auth instance
|
||||||
const auth = new AuthFlow({
|
const auth = new AuthFlow({
|
||||||
client_id: options.client_id || (env(c).GITHUB_ID as string),
|
client_id: options.client_id || (env(c).GITHUB_ID as string),
|
||||||
|
|
|
@ -13,9 +13,10 @@ export function linkedinAuth(options: {
|
||||||
scope?: LinkedInScope[]
|
scope?: LinkedInScope[]
|
||||||
appAuth?: boolean
|
appAuth?: boolean
|
||||||
redirect_uri?: string
|
redirect_uri?: string
|
||||||
|
state?: string
|
||||||
}): MiddlewareHandler {
|
}): MiddlewareHandler {
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
const newState = getRandomState()
|
const newState = options.state || getRandomState()
|
||||||
// Create new Auth instance
|
// Create new Auth instance
|
||||||
const auth = new AuthFlow({
|
const auth = new AuthFlow({
|
||||||
client_id: options.client_id || (env(c).LINKEDIN_ID as string),
|
client_id: options.client_id || (env(c).LINKEDIN_ID as string),
|
||||||
|
|
|
@ -14,10 +14,11 @@ export function xAuth(options: {
|
||||||
client_id?: string
|
client_id?: string
|
||||||
client_secret?: string
|
client_secret?: string
|
||||||
redirect_uri?: string
|
redirect_uri?: string
|
||||||
|
state?: string
|
||||||
}): MiddlewareHandler {
|
}): MiddlewareHandler {
|
||||||
return async (c, next) => {
|
return async (c, next) => {
|
||||||
// Generate encoded "keys"
|
// Generate encoded "keys"
|
||||||
const newState = getRandomState()
|
const newState = options.state || getRandomState()
|
||||||
const challenge = await getCodeChallenge()
|
const challenge = await getCodeChallenge()
|
||||||
|
|
||||||
const auth = new AuthFlow({
|
const auth = new AuthFlow({
|
||||||
|
|
Loading…
Reference in New Issue