Skip to content

Commit

Permalink
chore: adjust steam id checker
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedrangel committed Sep 21, 2024
1 parent c4a8fd4 commit 0cf1e5c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/runtime/server/lib/oauth/steam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ export function oauthSteamEventHandler({ config, onSuccess, onError }: OAuthConf

const idRegex = /^https?:\/\/steamcommunity\.com\/openid\/id\/(\d+)$/
const steamIdCheck = idRegex.exec(query['openid.claimed_id'])
const steamId = steamIdCheck ? steamIdCheck[1] : null

if (
query['openid.op_endpoint'] !== config.authorizationURL
|| !steamId
|| !steamIdCheck
|| query['openid.ns'] !== openIdCheck.ns
|| !query['openid.claimed_id']?.startsWith(openIdCheck.claimed_id)
|| !query['openid.identity']?.startsWith(openIdCheck.identity)
Expand All @@ -76,6 +75,8 @@ export function oauthSteamEventHandler({ config, onSuccess, onError }: OAuthConf
return onError(event, error)
}

const steamId = steamIdCheck[1]

// TODO: improve typing
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const user: any = await $fetch(withQuery('https://api.steampowered.com/ISteamUser/GetPlayerSummaries/v2/', {
Expand Down

0 comments on commit 0cf1e5c

Please sign in to comment.