Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] publishing an API fails with code":"ValidationError","message":"Cannot use OAuth2AuthenticationSettings in combination with OAuth2 nor openid. using v6.0.1-rc1 #597

Closed
shawnyu5 opened this issue Jul 23, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@shawnyu5
Copy link

shawnyu5 commented Jul 23, 2024

Release version

v6.0.1-rc1

Describe the bug

Publishing an API fails with the error message: code":"ValidationError","message":"Cannot use OAuth2AuthenticationSettings in combination with OAuth2 nor openid.

In the apiInformation.json of the failing API, there are these lines:

    "authenticationSettings": {
      "oAuth2": {
        "authorizationServerId": "oauth2b2b"
      },
      "oAuth2AuthenticationSettings": [
        {
          "authorizationServerId": "oauth2b2b"
        }
      ],
      "openidAuthenticationSettings": []
    },

This is produced by the extractor, with no modification.

In the APIM portal, User authorization setting is set to OAuth 2.0

image

The API will publish successfully if oAuth2 and openidAuthenticationSettings field is removed, leaving only oAuth2AuthenticationSettings. But since these files are produced by the extractor, these modifications should not be necessary.

Expected behavior

The API to be published successfully.

Actual behavior

API fails to publish

Reproduction Steps

  1. Create an API with User authorization set to OAuth 2, and provide an OAuth 2.0 server
  2. Use the extractor to extract the API
  3. Use the publisher to publish the API the extractor just extracted
Copy link

  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.

@DibyaRanjan1
Copy link

We are getting the same issue. @waelkdouh any fix for this issue ?

@guythetechie guythetechie moved this to 📋 Backlog in APIOPS Roadmap Jul 25, 2024
@guythetechie
Copy link
Contributor

Thanks, was able to replicate the issue. Will roll out a fix.

@waelkdouh waelkdouh added the bug Something isn't working label Jul 25, 2024
@itssKrish
Copy link

I have three env's, and I'm facing this with only one. I'm not sure if it's related to APIOps or an Azure side issue. my all envs are on same version. Thanks!

ref: Azure/azure-cli#26895

@guythetechie
Copy link
Contributor

It's an issue with the Azure REST API. Retrieving an API returns both oAuth2 and oAuth2AuthenticationSettings. Information is duplicated in both properties.

Making a PUT request with both properties fails with the error message above. Workaround is to remove one of the two properties.

guythetechie pushed a commit that referenced this issue Jul 29, 2024
@guythetechie guythetechie moved this from 📋 Backlog to 👀 In review in APIOPS Roadmap Jul 29, 2024
guythetechie pushed a commit that referenced this issue Jul 29, 2024
- Add workspaces (gated behind configuration)
- Switch from handlers to providers for DI
- Fix for #597
@itssKrish
Copy link

Hi, I can see some fix is merged in v6-rc2 branch by @guythetechie and I tested this scenario again, I'm no longer facing this issue.

@guythetechie guythetechie moved this from 👀 In review to ✅ Done in APIOPS Roadmap Aug 5, 2024
@mchaturvedi123
Copy link

mchaturvedi123 commented Sep 13, 2024

I am still seeing this issue with 'az apim api update' in my yaml pipeline. I am trying to update resource-group, service-name and service-url @guythetechie

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

6 participants