Javascript 中的授权承载令牌头 [英] Authorization Bearer Token Header in Javascript

查看:30
本文介绍了Javascript 中的授权承载令牌头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我从 API 端生成的授权不记名令牌创建标头.我正在使用 CORS-anywhere 来调用 API 并通过 JSON 获取数据.我想知道,授权不记名令牌标头的正确格式是什么?

I am trying to create a header for an authorization bearer token that I generated from the API's side. I am using CORS-anywhere to call the API and get the data through JSON. I was wondering, what is the correct format for the authorization bearer token header?

推荐答案

HTTP 授权 具有以下语法:

The HTTP Authorization has the following syntax:

授权:<类型><凭据>

对于您的特定用例,即使用不记名令牌,请求标头应为:

For your particular use case i.e. using a Bearer Token the request header should be:

Authorization: Bearer

这篇关于Javascript 中的授权承载令牌头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆