Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion packages/openauth/src/issuer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ export interface AuthorizationState {
state: string
client_id: string
audience?: string
prompts?: string
pkce?: {
challenge: string
method: "S256"
Expand Down Expand Up @@ -1018,12 +1019,14 @@ export function issuer<
const audience = c.req.query("audience")
const code_challenge = c.req.query("code_challenge")
const code_challenge_method = c.req.query("code_challenge_method")
const prompt = c.req.query("prompt")
const authorization: AuthorizationState = {
response_type,
redirect_uri,
state,
client_id,
audience,
prompt,
pkce:
code_challenge && code_challenge_method
? {
Expand Down Expand Up @@ -1062,7 +1065,11 @@ export function issuer<
)
throw new UnauthorizedClientError(client_id, redirect_uri)
await auth.set(c, "authorization", 60 * 60 * 24, authorization)
if (provider) return c.redirect(`/${provider}/authorize`)
if (provider) {
const providerUrl = new URL(`/${provider}/authorize`, c.req.url)
if (prompt) providerUrl.searchParams.set("prompt", prompt)
return c.redirect(providerUrl.pathname + providerUrl.search)
}
const providers = Object.keys(input.providers)
if (providers.length === 1) return c.redirect(`/${providers[0]}/authorize`)
return auth.forward(
Expand Down
4 changes: 4 additions & 0 deletions packages/openauth/src/provider/oauth2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ export function Oauth2Provider(
for (const [key, value] of Object.entries(query)) {
authorization.searchParams.set(key, value)
}
const prompt = c.req.query("prompt")
if (prompt) {
authorization.searchParams.set("prompt", prompt)
}
return c.redirect(authorization.toString())
})

Expand Down
6 changes: 4 additions & 2 deletions packages/openauth/src/ui/password.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ type PasswordUICopy = typeof DEFAULT_COPY
/**
* Configure the password UI.
*/
export interface PasswordUIOptions
extends Pick<PasswordConfig, "sendCode" | "validatePassword"> {
export interface PasswordUIOptions extends Pick<
PasswordConfig,
"sendCode" | "validatePassword"
> {
/**
* Custom copy for the UI.
*/
Expand Down