Forum

    • Register
    • Login
    • Search
    • Categories

    How can I submit auth token in header?

    General Questions
    3
    6
    109
    Loading More Posts
    • 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.
    • H
      harris rosendahl last edited by harris rosendahl

      I am just trying to use HISE Server API with a token system.

      When username and password information were inserted, there is a server token response like below. I am saving this information for credentials.

      {
        "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodH",
      }
      

      I need to use this token with authorization request header on API calls. How can I submit auth token in header with Hise?
      I couldn't get a way to use this with Server.callWithPOST

      POST /resource HTTP/1.1
      Host: server.example.com
      Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodH
      
      1 Reply Last reply Reply Quote 0
      • Christoph Hart
        Christoph Hart last edited by

        https://docs.hise.audio/scripting/scripting-api/server/index.html#sethttpheader

        H 1 Reply Last reply Reply Quote 1
        • H
          harris rosendahl @Christoph Hart last edited by

          @Christoph-Hart Hmm thank you. I will try it...

          1 Reply Last reply Reply Quote 0
          • Christoph Hart
            Christoph Hart last edited by

            In PercX we use this format for the header:

            Authorization: Token eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodH
            
            H 1 Reply Last reply Reply Quote 0
            • H
              harris rosendahl @Christoph Hart last edited by

              @Christoph-Hart

              I see. In my system, I use a JWT wordpress plugin that excepts

              Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodH
              
              

              format. Because of that I guess I use this (decryptedData contains token value):

              Server.setHttpHeader("Authorization: Bearer " + decryptedData.token);
              
              
              d.healey 1 Reply Last reply Reply Quote 0
              • d.healey
                d.healey @harris rosendahl last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • First post
                  Last post

                3
                Online

                1.2k
                Users

                7.0k
                Topics

                64.8k
                Posts