feat(oauth-providers): Allow passing state in google oath middleware (#454)
* improve(#453): Allow for state to be passed to AuthFlow * fix(#453): No need to cast as string * chore(#453): Create changeset Closes #453 * fix(#453): Needed to take CSRF into accountpull/469/head
parent
3c351e1097
commit
65418948ab
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@hono/oauth-providers': minor
|
||||
---
|
||||
|
||||
Allow for an optional state arg to be passed to Google Auth middleware
|
|
@ -11,9 +11,10 @@ export function googleAuth(options: {
|
|||
prompt?: 'none' | 'consent' | 'select_account'
|
||||
client_id?: string
|
||||
client_secret?: string
|
||||
state?: 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 || (c.env?.GOOGLE_ID as string),
|
||||
|
|
Loading…
Reference in New Issue