Nesta página

Exemplo do Reddit

Demonstra a autenticação com OAuth 2 para acessar o Reddit.

Captura de tela do exemplo

O exemplo do Reddit utiliza o OAuth 2, conforme suportado por Qt Network Authorization, para fazer login no Reddit e exibir as postagens do Reddit (em formato de texto) associadas ao usuário autenticado.

Para usar este exemplo, é necessária uma chave de consumidor do Reddit. Para registrar o aplicativo, acesse https://www.reddit.com/prefs/apps/.

Observação: escolha “aplicativo instalado ” ao criar o aplicativo.

Observação: defina o URI de redirecionamento como http://localhost:1337/ nas configurações do Reddit.

Executando o exemplo

Você pode executar o exemplo a partir de:

Antes de iniciar, adicione --client-id à linha de comando do executável, seguido da sua chave de consumidor, disponível em https://www.reddit.com/prefs/apps/.

Projeto de exemplo em code.qt.io

© 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.