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. Oauth2 AuthenticationError: Code not received - How to receive auth code by POST method?
Forum Updated to NodeBB v4.3 + New Features

Oauth2 AuthenticationError: Code not received - How to receive auth code by POST method?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.1k 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.
  • U Offline
    U Offline
    udayraj123
    wrote on last edited by udayraj123
    #1

    Hi all, I am trying to create a simple app that can obtain the access_token using OAuth2.

    For this, I have followed the Qt Reddit Example as reddit also uses OAuth2. It ran successfully by showing the live feed. Now I've ported the same code to be used on a different server.

    But there's a problem - the server returns the code parameter in POST data instead of GET data (nothing seen in url bar unlike the reddit case). So my Qt app is unable to read the data and is giving the error - qt.networkauth.oauth2: AuthenticationError: Code not received.

    I can see the POST data from the Network tab in Firefox. If I manually feed the code from there, the app continues and works successfully. How do I make it read the auth code from a POST response?

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

      Hi and welcome to devnet,

      You should give more information about that server that does things differently.

      What version of Qt are you using ?

      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
      • U Offline
        U Offline
        udayraj123
        wrote on last edited by udayraj123
        #3

        Hi, I am using Qt 5.11.0
        May I ask what more information do you need about the server?
        It is doing everything exactly like reddit's server except for the step the one mentioned above i.e. of returning a POST response instead of a GET/redirection response

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

          Is it something that's publicly accessible ?
          Maybe one can get it to run on its own computer for testing etc.

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

          U 1 Reply Last reply
          0
          • SGaistS SGaist

            Is it something that's publicly accessible ?
            Maybe one can get it to run on its own computer for testing etc.

            U Offline
            U Offline
            udayraj123
            wrote on last edited by
            #5

            Sorry @SGaist, the server is not publicly accessible yet. But I found that microsoft's oauth2 flow includes a parameter response_mode:

            • response_mode: Specifies the method that should be used to send the resulting token back to your app. Can be query or form_post. query provides the code as a query string parameter on your redirect URI, while form_post executes a POST containing the code to your redirect URI.

            So can you please use this as an alternative for testing?
            https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-protocols-oauth-code

            1 Reply Last reply
            0
            • U Offline
              U Offline
              udayraj123
              wrote on last edited by
              #6

              @SGaist Please have a look at the methods shown here in brief: https://stackoverflow.com/a/50848992

              I want to know if Qt's auth flow supports the form_post method. If yes, how to do it?

              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