使用客户端凭据通过Swagger UI.NET对Auth0进行身份验证

问题描述

我正尝试使用客户端凭据通过Swagger UI(由Swashbuckle.AspNetCore自动生成)对Auth0租户进行身份验证。

我遇到以下错误

Auth ErrorError,错误:access_denied,描述:非全局客户端 不允许访问APIv1

以下是屏幕截图:

enter image description here

Open API规范如下:

TestComposite extends Composite{
   private Label childlabel;    
   private Group group;
   private TabFolder tabFolder;
   private Button button;

    TestComposite(Compossite parent){
       super(parent,SWT.NONE);
       setLayout(new GridLayout(1,true));
       setFont(parent.getFont());
       setBackground(parent.getBackground());
       GridDataFactory.fillDefaults().grab(true,true).applyTo(this);
       createControl();
    }

    public void createControl() {

    this.group = new Group(this,SWT.SHADOW_IN);       
    this.group.setSize(this.getdisplay().getActiveShell().getSize());        
    this.button = new Button(this.group,SWT.PUSH); 
    GridDataFactory.swtDefaults().applyTo(this.button);
         
    this.tabFolder = new TabFolder(this,SWT.TOP);
    GridDataFactory.swtDefaults().align(SWT.FILL,SWT.FILL).grab(true,true).applyTo(this.tabFolder);

    Composite childComposite = new Composite(this,SWT.NONE);
    childComposite .setLayout(new GridLayout(2,false));
    GridDataFactory.swtDefaults().grab(true,false).align(SWT.LEFT,SWT.TOP).applyTo(childComposite );
    this.childLabel = new Label(childComposite,SWT.NONE);
    GridDataFactory.swtDefaults().grab(true,false).applyTo(childlabel);

    setInput(abc);
    enableVisibilityOfGroup(false);
}

public void enableVisibilityOfGroup(Boolean visible){
    this.group.setVisible(visible);
    // this shoudl redraw the UI and shown only tabFolder and label in the
    // whole wizard page,but there is blank space in place of group
    this.layout(true);
}
    

}

我怀疑这与未指定"securitySchemes": { "auth0": { "type": "oauth2","flows": { "clientCredentials": { "tokenUrl": "https://example.auth0.com/oauth/token" },"authorizationCode": { "authorizationUrl": "https://example.auth0.com/authorize?audience=test","tokenUrl": "https://example.auth0.com/oauth/token","scopes": { } } } } } 有关。我在授权代码流程上也遇到了类似的问题,但是通过将受众群体作为查询字符串参数附加到audience(如上所示)来使其工作。不幸的是,同一技巧不适用于客户凭证流(即尝试将受众群体附加到authorizationUrl)。我需要支持客户端凭据流,因为一条或多条路由仅需要锁定为M2M令牌。

有趣的是,如果我使用全局客户端ID /密码(在租户的高级设置下找到),它可以工作,但是我不确定是否应该使用此密码...

其他任何人都遇到了这个问题,如果是这样,那么找到解决方案有运气吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)