Skip to main content
Glama
exchange.ts1.16 kB
// SPDX-FileCopyrightText: Copyright Orangebot, Inc. and Medplum contributors // SPDX-License-Identifier: Apache-2.0 import { OAuthTokenType } from '@medplum/core'; import type { Request, Response } from 'express'; import { body } from 'express-validator'; import { exchangeExternalAuthToken } from '../oauth/token'; import { makeValidationMiddleware } from '../util/validator'; /* * Exchange an access token from an external auth provider for a Medplum access token. * This requires that the client application has been configured with the external auth provider. * * Deprecated. Use /oauth2/token with grant_type of "urn:ietf:params:oauth:grant-type:token-exchange" instead. */ export const exchangeValidator = makeValidationMiddleware([ body('externalAccessToken').notEmpty().withMessage('Missing externalAccessToken'), body('clientId').notEmpty().withMessage('Missing clientId'), ]); export const exchangeHandler = async (req: Request, res: Response): Promise<void> => { return exchangeExternalAuthToken( req, res, req.body.clientId as string, req.body.externalAccessToken as string, OAuthTokenType.AccessToken ); };

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