Azure / Azure/api-management-developer-portal
Custom Widget: Management API value is wrong getting from APIM
- 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.

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.

## 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