msgraph-sdk-javascript
msgraph-sdk-javascript copied to clipboard
Create a setter for baseUri
Feature Request
Add the ability to set the baseUri of the graph client after the client has been initialized. This will make it easier to change the baseUri
of the graph client in scenarios where the developer might not own the code that initializes the graph client (such as the Microsoft Graph Toolkit)
Describe the solution you'd like
const client = MicrosoftGraph.Client.init(...);
client.baseUri = 'https://graph.microsoft-ppe.com';
// or
client.setBaseUri('https://graph.microsoft-ppe.com');
Additional context
Request coming out of a request on the Microsoft Graph Toolkit to support additional baseUris:
https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/1053 https://github.com/microsoftgraph/microsoft-graph-toolkit/issues/1030
@nmetulev Thank you for this feature request!
Adding to the description of this issue, we should discuss providing ways to modify the other client configs after the client is initialized.
Agree 💯
My concerns:
- Authentication tokens are tied to a host URI and by changing the base URI the token will no longer be valid. At least that's my understanding.
- We advise developers to create one client per host + endpoint. The API surface and behavior can change between hosts and endpoints which can lead to unexpected results. For this reason we discourage changing the base URI.
- (hypothetical) Middleware has the potential to be keyed to a specific cloud. For example, logging requests to some cloud service. It could trigger a compliance event.
Does anyone know if this issue is being picked up by MSFT or is it waiting to be fixed by the community?
@jimmywim This request will need some some more discussion with the Graph SDK team.
I would like to know what is your take on this issue?
@nikithauc No worries, would be good to know if this is on the timeline to be implemented or not.
Any solution that uses this SDK to communicate to MS Graph (for example Microsoft Graph Toolkit) is not currently portable to any National Cloud instances of Microsoft 365 (including GCC and Germany).
@jimmywim The Graph JS SDK works with the National Cloud instances, that is,
"graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"
Please let me know if the case is otherwise.
Was delivered as part of v3. Closing.