'/' is not valid orgId
jackhatedance opened this issue · 2 comments
jackhatedance commented
Expected Behavior
No error when call U2C API.
Current Behavior
get 400 error when call U2C API, below is a example.
https://u2c.wbx2.com/u2c/api/v1/limited/catalog?orgId=%2F&format=hostmap
Possible Solution (we welcome any logical suggestion)
Example:
initServiceCatalogs() {
this.logger.info('services: initializing initial service catalogs');
// Destructure the credentials plugin.
const {credentials} = this.webex;
// Init a promise chain. Must be done as a Promise.resolve() to allow
// credentials#getOrgId() to properly throw.
return Promise.resolve()
// Get the user's OrgId.
.then(() => credentials.getOrgId())
// Begin collecting the preauth/limited catalog.
.then((orgId) => {
if(orgId!='/'){
this.collectPreauthCatalog({orgId})
}
})
.then(() => {
// Validate if the token is authorized.
if (credentials.canAuthorize) {
// Attempt to collect the postauth catalog.
return this.updateServices()
.catch(() => this.logger.warn(
'services: cannot retrieve postauth catalog'
));
}
// Return a resolved promise for consistent return value.
return Promise.resolve();
});
},
Steps to Reproduce
- open chrome, open devtools, goto network
- goto cart.webex.com
- filter by u2c
- there is a request return 400
Environment Details
- SDK Version: 1.63.2
- Node/Browser Version: Chrome 83
- NPM Version: v10
adamweeks commented
What type of access token are you using to get this error? It appears like cart.webex.com is attempting to initialize the sdk without authentication.
lalli-flores commented
The issue appears to be the request to the pre-auth catalog with an empty SDK. For now, don't the U2C fetch if the org id is invalid as suggested.
We have a task to do the check but it needs to be prioritized.