Azure / Azure/api-management-developer-portal

Custom Widget: Management API value is wrong getting from APIM

Open
#2,771 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
545
Forks
360
PR merge metrics
No merged PRs in 30d

Description

## Bug description

i have created a custom widget in my project in which i did not add any code just has default code which get the user token and user id and after getting token and userid, there is a method which gets the user details by calling management API REST API call.

while running the custom widget as local, "Get User details" call URL will be like "https://apiportal-dev.avnet.com/mapi/users/1?api-version=2023-03-01-preview" and getting CORS error.

![Image](https://github.com/user-attachments/assets/3f20fa83-cd5f-46fd-a3ce-5d048ce83fff)

i am getting confused that why management API URL does not contain full URL likee this "[https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}](https://management.azure.com/subscriptions/%7BsubscriptionId%7D/resourceGroups/%7BresourceGroupName%7D/providers/Microsoft.ApiManagement/service/%7BserviceName%7D)"

but it returns the "https://apiportal-dev.avnet.com/mapi" endpoint as shown in below image.

![Image](https://github.com/user-attachments/assets/93305a03-f2b1-435e-8b6f-4c4293fc82e7)

## Expected behavior

Management API value should be full URL i.e https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}

but it returns "https://apiportal-dev.avnet.com/mapi" and also getting CORS error if we use this URL.

## Is self-hosted portal?
No

## Release tag or commit SHA (if using self-hosted version)

[e.g., release `2.0.0`, commit `c45da9778b70d369aba60fa2e63c191efe2b548f`]

## API Management service name

https://apiportal-dev.avnet.com

## Environment

- Operating system: [windows]
- Browser: [e.g., all browser]
- Version: latest

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the custom widget locally and trace the “Get User details” management API REST call that returns the /mapi endpoint. Compare that value with the expected management.azure.com resource URL and investigate the resulting CORS behavior; done means the management API value is correct and the call no longer fails because of the returned endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.