Skip to content

setup default valid hosts for graph in graph core #1139

Open

Description

@baywet

related to microsoft/kiota#1063
related to microsoft/kiota-typescript#505

The original value for the default valid hostnames was removed from kiota authentication libraries to make them API agnostic and easier to use with other APIs.

Since the initialization of the client is a bit different here compared with other languages, I'm opening this issue to discuss the best approach to set those default values in graph core.
In other languages the approach was to make derived authentication and access token providers that would set the default.

Original default values:

new Set<string>([
      "graph.microsoft.com",
      "graph.microsoft.us",
      "dod-graph.microsoft.us",
      "graph.microsoft.de",
      "microsoftgraph.chinacloudapi.cn",
      "canary.graph.microsoft.com",
    ]

Activity

  1. added this to the 4.0.0 milestone on Jan 17, 2023
  2. nikithauc commented on Jan 17, 2023

    @nikithauc
    Contributor

    We already have this

    export const GRAPH_URLS = new Set<string>(["graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"]);
    

    export const GRAPH_URLS = new Set<string>(["graph.microsoft.com", "graph.microsoft.us", "dod-graph.microsoft.us", "graph.microsoft.de", "microsoftgraph.chinacloudapi.cn", "canary.graph.microsoft.com"]);

  3. nikithauc commented on Jan 17, 2023

    @nikithauc
    Contributor

    Currently this constant set is used to append or remove an auth header and telemetry header.

  4. baywet commented on Jan 18, 2023

    @baywet
    MemberAuthor

    Thanks for the information.
    How do you suggest we inject that value in the authentication providers (spfx, az identity,...) ? derive and overload or some other approach?

  5. nikithauc commented on Jan 18, 2023

    @nikithauc
    Contributor

    export const updateAndReturnAllAllowedHosts = (authProvider: BaseBearerTokenAuthenticationProvider): Set<string> => {

    Passing it at the time of initialization client instance.

  6. baywet commented on Jan 18, 2023

    @baywet
    MemberAuthor

    oh so it's already being done? perfect then. If you could just confirm and close the issue please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions