Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to use OAuth without authorization
Forum Updated to NodeBB v4.3 + New Features

How to use OAuth without authorization

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 421 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Magnus21
    wrote on last edited by
    #1

    Hi there,

    the Reddit API uses OAuth and I use QOAuth2AuthorizationCodeFlow to handle the user authorization, which works very well.

    However, I also want to implement userless OAuth, which is supported by Reddit to access the Reddit API read-only: https://github.com/reddit-archive/reddit/wiki/OAuth2#application-only-oauth

    In this case, there is no authorization step, the app just immediately requests the OAuth access token, like so:

    curl -H "Authorization: Basic $(echo -ne $REDDIT_CLIENT_ID | base64 --wrap 0)" -d 'device_id=DO_NOT_TRACK_THIS_DEVICE&grant_type=https://oauth.reddit.com/grants/installed_client' -X POST https://www.reddit.com/api/v1/access_token
    

    Which will return a valid OAuth access token with read only scope.

    Is this possible with the Qt authorization library?

    Unfortunately the grant() method always tries to authorize with an user and the setStatus() method is private, so I cannot skip the authorization step.

    Any idea how I can use the Qt OAuth libraries to retrieve this userless access token?

    Any help is greatly appreciated :)

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What about subclassing QOAuth2AuthorizationCodeFlow and reimplement grant so that it does what you want ?

      In any case, it looks like it could be a missing use case in the module. You should check the bug report system to see if there's anything related.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved