简体   繁体   English

WSO2 Api 管理器 - 沙盒/生产密钥

[英]WSO2 Api Manager - Sandbox/Production keys

Using WSO2 Api-M On-Prem v3.1.0.使用 WSO2 Api-M On-Prem v3.1.0。

I have set up an API in Publisher with different endpoints for Production and Sandbox.我在 Publisher 中设置了一个 API,具有不同的生产和沙盒端点。 Using API Key as Application Level Security.使用 API 密钥作为应用程序级安全性。 Enabled Security for my GET resource.为我的 GET 资源启用安全性。

In DevPortal I created an Application and set up an subscription for my API.在 DevPortal 中,我创建了一个应用程序并为我的 API 设置了订阅。 Generated Sandbox API Key and used "Try Out" in DevPortal.生成沙盒 API 密钥并在 DevPortal 中使用“试用”。 I can select Key Type " Production " and enter my Sandbox Key , I get OK response from Production endpoint.我可以 select 密钥类型“生产”并输入我的沙盒密钥,我从生产端点得到 OK 响应。

Try-Out screenshot试用截图

If I change Key Type to Sandbox , I still get response from Production endpoint.如果我将 Key Type 更改为Sandbox ,我仍然会从生产端点获得响应。 I see in http_access_.YYYY-MM-DD log that both requests are sent to my production endpoint.我在 http_access_.YYYY-MM-DD 日志中看到两个请求都发送到我的生产端点。

Why isn't my request sent to Sandbox when I use Sandbox API-Key as described in documentation:当我使用 Sandbox API-Key 时,为什么我的请求没有发送到 Sandbox,如文档中所述:

https://apim.docs.wso2.com/en/3.0.0/learn/api-gateway/maintaining-separate-production-and-sandbox-gateways/ https://apim.docs.wso2.com/en/3.0.0/learn/api-gateway/maintaining-separate-production-and-sandbox-gateways/

I reproduced this issue in API Manager version 3.1.0.我在 API Manager 版本 3.1.0 中重现了这个问题。 This is a bug and needs to be fixed.这是一个错误,需要修复。 I have created a GitHub issue for this.我为此创建了一个 GitHub 问题。 Please check [1].请检查[1]。

As a workaround for your scenario, please enable OAuth2 Application level security as well under the Runtime Configurations of your API in Publisher.作为您的方案的解决方法,请在 Publisher 中 API 的运行时配置下启用 OAuth2 应用程序级别安全性 So both OAuth2 and API Key needs to be selected.所以 OAuth2 和 API Key 都需要选择。

[1] https://github.com/wso2/product-apim/issues/8483 [1] https://github.com/wso2/product-apim/issues/8483

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM