fix(api): add session_id validation for webapp JWT authentication (#28297)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -30,10 +30,13 @@ type isWebAppLogin = {
|
||||
app_logged_in: boolean
|
||||
}
|
||||
|
||||
export async function webAppLoginStatus(shareCode: string) {
|
||||
export async function webAppLoginStatus(shareCode: string, userId?: string) {
|
||||
// always need to check login to prevent passport from being outdated
|
||||
// check remotely, the access token could be in cookie (enterprise SSO redirected with https)
|
||||
const { logged_in, app_logged_in } = await getPublic<isWebAppLogin>(`/login/status?app_code=${shareCode}`)
|
||||
const params = new URLSearchParams({ app_code: shareCode })
|
||||
if (userId)
|
||||
params.append('user_id', userId)
|
||||
const { logged_in, app_logged_in } = await getPublic<isWebAppLogin>(`/login/status?${params.toString()}`)
|
||||
return {
|
||||
userLoggedIn: logged_in,
|
||||
appLoggedIn: app_logged_in,
|
||||
|
||||
Reference in New Issue
Block a user