• Fetches and validates OIDC well-known configuration.

    Pass a custom requestFn to control how the HTTP request is made. When omitted, the built-in Fetch API is used (with a 30-second timeout).

    Parameters

    • url: string

      The well-known endpoint URL

    • OptionalrequestFn: WellknownRequestFn

      Optional custom request function (e.g., RTK Query's baseQuery)

    Returns Promise<FetchWellknownResult>

    A FetchWellknownResult — either { success: true, data } or { success: false, error }

    // Simple — uses built-in fetch
    const result = await fetchWellknownConfiguration(
    'https://auth.example.com/.well-known/openid-configuration',
    );
    // With RTK Query baseQuery — inside a queryFn
    queryFn: async (url, _api, _extra, baseQuery) => {
    const result = await fetchWellknownConfiguration(url, baseQuery);
    return result.success ? { data: result.data } : { error: result.error };
    }