ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix external on logout hook
Chocobozzz97aeb3cc46c2
diff --git a/server/controllers/api/users/token.ts b/server/controllers/api/users/token.tsindex 3eae28b34b..694bb0a929 100644--- a/server/controllers/api/users/token.ts+++ b/server/controllers/api/users/token.ts@@ -88,7 +88,7 @@ async function handleToken (req: express.Request, res: express.Response, next: easync function handleTokenRevocation (req: express.Request, res: express.Response) {const token = res.locals.oauth.token- const result = await revokeToken(token, true)+ const result = await revokeToken(token, { req, explicitLogout: true })return res.json(result)}diff --git a/server/lib/auth/oauth-model.ts b/server/lib/auth/oauth-model.tsindex c74869ee25..b9c69eb2db 100644--- a/server/lib/auth/oauth-model.ts+++ b/server/lib/auth/oauth-model.ts@@ -1,3 +1,4 @@+import * as express from 'express'import { AccessDeniedError } from 'oauth2-server'import { PluginManager } from '@server/lib/plugins/plugin-manager'import { ActorModel } from '@server/models/activitypub/actor'@@ -125,15 +126,20 @@ async function getUser (usernameOrEmail?: string, password?: string, bypassLoginasync function revokeToken (tokenInfo: { refreshToken: string },- explicitLogout?: boolean+ options: {+ req?: express.Request+ explicitLogout?: boolean+ } = {}): Promise<{ success: boolean, redirectUrl?: string }> {+ const { req, explicitLogout } = options+const token = await OAuthTokenModel.getByRefreshTokenAndPopulateUser(tokenInfo.refreshToken)if (token) {let redirectUrl: stringif (explicitLogout === true && token.User.pluginAuth && token.authName) {- redirectUrl = await PluginManager.Instance.onLogout(token.User.pluginAuth, token.authName, token.User, this.request)+ redirectUrl = await PluginManager.Instance.onLogout(token.User.pluginAuth, token.authName, token.User, req)}TokensCache.Instance.clearCacheByToken(token.accessToken)