Skip to main content
Glama
test-auth.ts1.13 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { allOk, normalizeErrorString } from '@medplum/core'; import type { BotEvent, MedplumClient } from '@medplum/core'; export async function handler(_medplum: MedplumClient, event: BotEvent): Promise<any> { const CLIENT_ID = event.secrets['PHOTON_CLIENT_ID']?.valueString as string; const CLIENT_SECRET = event.secrets['PHOTON_CLIENT_SECRET']?.valueString as string; const body = { client_id: CLIENT_ID, client_secret: CLIENT_SECRET, audience: 'https://api.neutron.health', grant_type: 'client_credentials', }; try { const response = await fetch('https://auth.neutron.health/oauth/token', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, body: JSON.stringify(body), }); if (!response.ok) { throw new Error(`HTTP error, status: ${response.status}, ${response.statusText}`); } return allOk; } catch (err) { throw new Error(normalizeErrorString(err)); } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/medplum/medplum'

If you have feedback or need assistance with the MCP directory API, please join our Discord server