mirror of
https://github.com/opf/openproject.git
synced 2026-06-13 19:20:00 +00:00
fix(hocuspocus): include useful information in token validation errors (#22403)
Port of https://github.com/opf/op-blocknote-hocuspocus/pull/55 Co-authored-by: Markus Kahl <m.kahl@openproject.com>
This commit is contained in:
@@ -25,11 +25,11 @@ export async function decryptAndValidateToken(
|
||||
} = decryptToken(encryptedToken);
|
||||
|
||||
if (requestOrigin && !tokenResourceUrl?.startsWith(requestOrigin)) {
|
||||
throw new Error('Unauthorized: Token origin does not match request origin.');
|
||||
throw new Error(`Unauthorized: Token origin does not match request origin. Expected ${tokenResourceUrl} to start with ${requestOrigin}.`);
|
||||
}
|
||||
|
||||
if (tokenResourceUrl !== resourceUrl) {
|
||||
throw new Error('Unauthorized: Token resource URL does not match document.');
|
||||
throw new Error(`Unauthorized: Token resource URL does not match document. Expected ${tokenResourceUrl}, got ${resourceUrl}.`);
|
||||
}
|
||||
|
||||
const response = await fetchResource(resourceUrl, oauth_token);
|
||||
|
||||
Reference in New Issue
Block a user