The discussion revolves around accessing a password-protected Discourse feed on an external WordPress site using Single Sign-On (SSO). strategeek initially asked for help, and eviltrout suggested generating an API key for a user account and appending it to the URL. However, this approach raises security concerns, as the API key can be used to perform actions as the underlying user account.
eviltrout also warned against generating an “All Users” API key, which could compromise the entire site. dansingerman reported an issue where RSS feeds with read restrictions do not work with API keys, even when the key is valid for the user. This was confirmed to be a bug by eviltrout and later fixed by techAPJ.
However, scombs reported that the fix only resolves the issue for restricted categories, not the “Latest” feed. codinghorror noted that API keys now need to be passed in headers, not URLs. sam and blake discussed the challenges of implementing private RSS feeds with API keys, as most RSS readers do not support custom headers.
sam proposed a solution involving tightly scoped user API keys, but this would require significant development work. xadium expressed interest in maintaining the URL auth mechanism for private RSS feeds, citing a use case where they integrate WordPress and Discourse. Jack_Ukleja reported mixed results when using API keys for private RSS feeds, with some feeds working but others not. sptrf suggested that specifying an accepting header is necessary to fetch the correct RSS data with an API key.
I should note there are security issues with making that api key visible to users. If someone has it, they can do anything that the underlying user account can do. It would be much better to fetch the RSS server side using the key then only exposing the resulting feed.
Also, be especially careful not to generate an “All Users” key for this. If someone gets that key they can do anything as any user on your site. So just be extra careful
We are having the issue that the RSS feeds do not work with an api_key if the categories have read restrictions, even if the api_key is valid for a user that should be able to access the category.
这里有一个与@david 的部分范围界定工作相关的想法:我们可以创建一个严格限定于单个 RSS 订阅源的用户 API 密钥。这样一来,暴露面就会很小。在这种情况下,对于这种超范围限定的用户 API 密钥,我们可以允许其在不使用请求头的情况下进行认证(即在 user_api_key 表中增加一列,标记该密钥可用于通过 GET 请求进行认证)。
目前的挑战在于:
我们还没有让用户生成用户 API 密钥的机制。我们需要为 RSS 用例构建一些功能,这将涉及新的用户体验设计。我不确定应该将其添加在哪里,也许是在用户个人资料中,目前还不确定。