Reddit 示例
演示了如何使用 OAuth 2 进行身份验证以访问 Reddit。

该Reddit示例使用 OAuth 2(由Qt Network Authorization 支持)登录 Reddit,并显示与已认证用户关联的 Reddit 帖子(文本格式)。
要使用此示例,需要一个来自 Reddit 的客户端密钥。请访问https://www.reddit.com/prefs/apps/ 注册应用程序。
注意: 创建应用程序时,请选择 “已安装的应用程序”。
注意: 在 Reddit 设置中将 重定向 URI设置 为http://localhost:1337/。
运行示例
您可以通过以下方式运行示例:
- Qt Creator
打开“Welcome ”模式,并从Examples 中选择该示例。有关更多信息,请参阅Qt Creator :教程:构建和运行。
- Qt Extension for Visual Studio Code
在Command Palette 中运行Qt: Open Qt examples 命令,并从列表中选择该示例。有关更多信息,请参阅Qt Extension for Visual Studio Code :教程:构建和运行。
启动前,请在可执行命令行中添加 `--client-id `,并随后跟上您从https://www.reddit.com/prefs/apps/ 获取的消费者密钥。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.