opencode
opencode copied to clipboard
fix: send `mcpName` as state if authUrl doesn't have `state`
Right now, if there's no state in the authorization URL opencode uses the MCP name as state...however it doesn't actually send the state parameter to the authorization server.
This, combined with a bug in better auth (where state comes back as the string undefined) which I'm gonna open a PR for in a minute, means that authentication will fail.
Now this is probably more of a better auth bug, but I would say that even returning an empty state could be problematic and if we are gonna use that state we might just also send it for real. This PR changes that.