我写的 headers 中的 “Authorization” 字符串是否正确?

huangapple go评论61阅读模式
英文:

Did I write the string for "Authorization" in headers correctly?

问题

I am writing code to add a paypal button to a page. There is this js code:

On the page: https://developer.paypal.com/docs/api/orders/v2/
The following is written:

Authorization string required
To make REST API calls, include the bearer token in this header with the Bearer authentication scheme. The value is Bearer <Access-Token> or Basic <client_id:secret>.

I seem to have written everything like that, but I get a 401 error that says about problems with authorization.
Did I write the string for "Authorization" in headers correctly?

英文:

I am writing code to add a paypal button to a page. There is this js code:

On the page: https://developer.paypal.com/docs/api/orders/v2/
The following is written:

Authorizationstringrequired
To make REST API calls, include the bearer token in this header with the Bearer authentication scheme. The value is Bearer <Access-Token> or Basic <client_id:secret>.

I seem to have written everything like that, but I get a 401 error that says about problems with authorization.
Did I write the string for "Authorization" in headers correctly?

答案1

得分: 0

Client-side/browser code (paypal.Buttons) should never directly call PayPal API endpoints; not under any circumstances. The code in this question should be removed.

Calls to the PayPal API should only be done through a backend/server. See the standard checkout integration guide for an example in node.js, but it can of course be implemented similarly in any other server environment/language.

英文:

Client-side/browser code (paypal.Buttons) should never directly call PayPal API endpoints; not under any circumstances. The code in this question should be removed.

Calls to the PayPal API should only be done through a backend/server. See the standard checkout integration guide for an example in node.js , but it can of course be implemented similarly in any other server environment/language.

huangapple
  • 本文由 发表于 2023年3月9日 19:22:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/75683929.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定