You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Magento 2.3.3获取Admin Token后资源访问授权失败问题求助

Magento 2.3.3 Admin Token权限问题解决办法

针对你遇到的获取Admin token后无法访问资源、提示"The consumer isn't authorized to access %resources."的问题,可尝试以下解决步骤:

  • 修正请求头格式:你当前设置的请求头Authorization: "Bearer <admin access token obtained>"包含多余的双引号,正确格式应为Authorization: Bearer <admin access token obtained>,去掉引号后重新请求。

  • 数据库手动启用Bearer token功能:Magento 2.3.3部分环境下该后台设置项可能不显示,直接通过SQL修改配置:

    INSERT INTO core_config_data (path, value) VALUES ('oauth/consumer/enable_integration_as_bearer', 1) ON DUPLICATE KEY UPDATE value = 1;
    

    执行后清理缓存:

    bin/magento cache:flush
    
  • 检查集成资源权限:进入后台「系统 > 集成」,编辑你用来获取token的集成,确认已勾选对应资源的权限(比如访问产品需勾选「目录 > 产品」相关权限),保存后重新生成token测试。

  • 验证token有效性:调用rest/V1/integration/admin/token/validate接口,请求头携带Bearer token,确认token是否处于有效状态。

  • 检查服务器配置:若使用Nginx,确保配置文件中包含proxy_set_header Authorization $http_authorization;,避免服务器拦截Authorization请求头;Apache则需确保mod_rewrite模块启用且规则正确。

内容的提问来源于stack exchange,提问作者noiseymur

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 18:01:26