Mirror confidential OAuth consent client resolution fix
This commit is contained in:
parent
482da6bf05
commit
733fa7dd4b
@ -51,7 +51,7 @@ export class CharacterOAuth{
|
||||
app.get('/mcp/consent',async(req,res)=>{
|
||||
const p=await this.codec.open(req.query.ticket);if(p?.purpose!=='mcp-consent')return res.status(400).send('Authorization expired. Reconnect your MCP client.');
|
||||
if(!req.identity){cookie(res,'__Host-character-mcp-return',await this.codec.seal({purpose:'mcp-return',ticket:req.query.ticket},600),600);return res.redirect('/auth/login')}
|
||||
const client=await this.storage.client(p.clientId);if(!client)return res.sendStatus(400);
|
||||
const client=await this.clientsStore.getClient(p.clientId);if(!client)return res.sendStatus(400);
|
||||
const nonce=randomUUID();cookie(res,'__Host-character-consent',await this.codec.seal({nonce,sub:req.identity.sub,ticketHash:hash(req.query.ticket)},600),600);
|
||||
res.type('html').send(`<!doctype html><meta name="viewport" content="width=device-width"><title>Connect Character</title><h1>Connect ${escape(client.client_name)}?</h1><p>This client can ${p.params.scopes.includes('characters:write')?'read and edit':'read'} the characters saved to your Arrowstack account and campaigns you belong to, within your campaign roles. Private character notes are never shared with the party. DM secrets require a DM role, and changing another player’s saved HP requires their explicit delegation.</p><p>Redirect destination: ${escape(new URL(p.params.redirectUri).origin)}</p><form method="post" action="/mcp/consent"><input type="hidden" name="ticket" value="${escape(req.query.ticket)}"><input type="hidden" name="nonce" value="${nonce}"><button name="decision" value="allow">Allow access</button><button name="decision" value="deny">Cancel</button></form>`);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user