在 ERB 中解密 Braintree 客户端令牌

Braintree Client Token Being Decrypted In ERB

我正在使用带有 Ruby 和 JS 的 Braintree 来尝试执行 Braintree Drop-In UI 的基本实现。

以下是一些相关的代码片段:

创建令牌的交易控制器 @client_token = Braintree::ClientToken

正在初始化令牌的页面 <script> braintree.setup(“<%= @client_token %>”, 'dropin', { container: 'checkout' }); </script>

出于某种原因,我最终得到了令牌的解密版本。输出如下所示:

{"version":1,"authorizationFingerprint":"9802dc7676997d457eb5c656470227a27828f15b12ec4acd3c2cec67782a3001|created_at=2015-03-23T04:29:28.438506721+0000\u0026merchant_id=8gtvngmjy6tmsxz4\u0026public_key=6rp8nrfbvmyfqjf8","configUrl":"
https://api.sandbox.braintreegateway.com:443/merchants/8gtvngmjy6tmsxz4/client_api/v1/configuration
","challenges":["cvv"],"clientApiUrl":"
https://api.sandbox.braintreegateway.com:443/merchants/8gtvngmjy6tmsxz4/client_api
","assetsUrl":"https://assets.braintreegateway.com","authUrl":"
https://auth.venmo.sandbox.braintreegateway.com","analytics":{"url":"
https://client-analytics.sandbox.braintreegateway.com
"},"threeDSecureEnabled":true,"threeDSecure":{"lookupUrl":"
https://api.sandbox.braintreegateway.com:443/merchants/8gtvngmjy6tmsxz4/three_d_secure/lookup
"},"paypalEnabled":true,"paypal":{"displayName":"None","clientId":null,"privacyUrl":"
http://example.com/pp","userAgreementUrl":"http://example.com/tos
","baseUrl":"https://assets.braintreegateway.com","assetsUrl":"
https://checkout.paypal.com
","directBaseUrl":null,"allowHttp":true,"environmentNoNetwork":true,"environment":"offline","unvettedMerchant":false,"braintreeClientId":"masterclient","merchantAccountId":"gbsgnv46xscgk868","currencyIsoCode":"USD"},"coinbaseEnabled":false}"

这肯定不是客户端令牌的样子。

为什么我最后得到的是解密版本?

看起来这是旧版本的客户端令牌。升级 gem 版本将为您提供编码的客户端令牌,而不是 json。