import { getRequestContextHeaders } from '@axinom/mosaic-service-common'; import axios from 'axios'; import type { WellKnownEndpoints } from '../common/types.js'; /** * This function returns the well known endpoints of id-service. * @param authEndpoint URL for id-service authEndpoint. * @returns {WellKnownEndpoints} Well known endpoints of id-service. */ export async function getWellKnownEndpoints( authEndpoint: string, ): Promise { const wellKnownEndpointUrl = new URL(`/.well-known`, `${authEndpoint}`).href; const result: WellKnownEndpoints = ( await axios.get(wellKnownEndpointUrl, { headers: getRequestContextHeaders(), }) ).data; return result; }