Uploaded image for project: 'ListenBrainz'
  1. ListenBrainz
  2. LB-1134

validate-token request not working with Authorization header

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Normal Normal
    • None
    • API
    • None

      According to the docs, the Token may be set on the Authorization header or as query param; but only the latter works.

      I have used the same Authorization header in multiple POST and GET request as seen here without problems:
      https://github.com/regorxxx/Playlist-Manager-SMP/blob/main/helpers/playlist_manager_listenbrainz.js

      So the code is working and the token has been tested to be valid. Doing the same with validate-token request returns a 200 response, while the same token as query param returns a valid response.

      Either the docs are wrong or something may have been missed in the API, but definitely Token does not work using headers.

          [LB-1134] validate-token request not working with Authorization header

          amCap1712 added a comment -

          Hi!

          The token is only accepted as a query param in the validate-token endpoint and that too for historical reasons. No other endpoint supports putting the token there, it must go into the Authorization header.

          I tested the validate-token endpoint both with the header and the query param and it works fine for me.

          curl 'https://api.listenbrainz.org/1/validate-token?token=TOKEN' 
          curl 'https://api.listenbrainz.org/1/validate-token' -H 'Authorization: Token TOKEN'
          

          In both cases, I get the same response:

          {    
              "code": 200,
              "message": "Token valid.",
              "user_name": "lucifer",
              "valid": true
          } 

          Can you share the request and response you made which is behaving incorrectly?

          amCap1712 added a comment - Hi! The token is only accepted as a query param in the validate-token endpoint and that too for historical reasons. No other endpoint supports putting the token there, it must go into the Authorization header. I tested the validate-token endpoint both with the header and the query param and it works fine for me. curl 'https: //api.listenbrainz.org/1/validate-token?token=TOKEN' curl 'https: //api.listenbrainz.org/1/validate-token' -H 'Authorization: Token TOKEN' In both cases, I get the same response: { "code" : 200, "message" : "Token valid." , "user_name" : "lucifer" , "valid" : true } Can you share the request and response you made which is behaving incorrectly?

            Unassigned Unassigned
            Isabelxxx Isabelxxx
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package