Custom HTTP Authorization Header

后端 未结 4 934
清歌不尽
清歌不尽 2020-11-29 15:53

I was wondering if it\'s acceptable to put custom data in an HTTP authorization header. We\'re designing a RESTful API and we may need a way to specify a custom method of au

4条回答
  •  野性不改
    2020-11-29 16:30

    Old question I know, but for the curious:

    Believe it or not, this issue was solved ~2 decades ago with HTTP BASIC, which passes the value as base64 encoded username:password. (See http://en.wikipedia.org/wiki/Basic_access_authentication#Client_side)

    You could do the same, so that the example above would become:

    Authorization: FIRE-TOKEN MFBONUoxN0hCR1pIVDdKSjNYODI6ZnJKSVVOOERZcEtEdE9MQ3dvLy95bGxxRHpnPQ==
    

提交回复
热议问题