Skip to content

Commit

Permalink
chore: upadte X handler
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux committed Aug 28, 2024
1 parent 5675aaf commit 7e81c27
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/runtime/server/lib/oauth/x.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ export interface OAuthXConfig {
*/
scope?: string[]

/**
* Require email from user
* @default false
*/
emailRequired?: boolean

/**
* X OAuth Authorization URL
* @default 'https://twitter.com/i/oauth2/authorize'
Expand All @@ -60,7 +54,7 @@ export interface OAuthXConfig {
* Extra authorization parameters to provide to the authorization URL
* @see https://developer.x.com/en/docs/authentication/oauth-2-0/user-access-token
*/
authorizationParams: Record<string, string>
authorizationParams?: Record<string, string>

/**
* Redirect URL to to allow overriding for situations like prod failing to determine public hostname
Expand All @@ -76,9 +70,9 @@ export function oauthXEventHandler({
}: OAuthConfig<OAuthXConfig>) {
return eventHandler(async (event: H3Event) => {
config = defu(config, useRuntimeConfig(event).oauth?.x, {
authorizationURL: 'https://twitter.com/i/oauth2/authorize',
tokenURL: 'https://api.twitter.com/2/oauth2/token',
userURL: 'https://api.twitter.com/2/users/me',
authorizationURL: 'https://x.com/i/oauth2/authorize',
tokenURL: 'https://api.x.com/2/oauth2/token',
userURL: 'https://api.x.com/2/users/me',
authorizationParams: {
state: randomUUID(),
code_challenge: randomUUID(),
Expand Down

0 comments on commit 7e81c27

Please sign in to comment.