@modelcontextprotocol/sdk
    Preparing search index...

    Function refreshAuthorization

    • Exchange a refresh token for an updated access token.

      Supports multiple client authentication methods as specified in OAuth 2.1:

      • Automatically selects the best authentication method based on server support
      • Preserves the original refresh token if a new one is not returned

      Parameters

      • authorizationServerUrl: string | URL

        The authorization server's base URL

      • options: {
            addClientAuthentication?: (
                headers: Headers,
                params: URLSearchParams,
                url: string | URL,
                metadata?: AuthorizationServerMetadata,
            ) => void | Promise<void>;
            clientInformation: {
                client_id: string;
                client_id_issued_at?: number;
                client_secret?: string;
                client_secret_expires_at?: number;
            };
            fetchFn?: FetchLike;
            metadata?: AuthorizationServerMetadata;
            refreshToken: string;
            resource?: URL;
        }

        Configuration object containing client info, refresh token, etc.

        • OptionaladdClientAuthentication?: (
              headers: Headers,
              params: URLSearchParams,
              url: string | URL,
              metadata?: AuthorizationServerMetadata,
          ) => void | Promise<void>
        • clientInformation: {
              client_id: string;
              client_id_issued_at?: number;
              client_secret?: string;
              client_secret_expires_at?: number;
          }
        • OptionalfetchFn?: FetchLike
        • Optionalmetadata?: AuthorizationServerMetadata
        • refreshToken: string
        • Optionalresource?: URL

      Returns Promise<
          {
              access_token: string;
              expires_in?: number;
              id_token?: string;
              refresh_token?: string;
              scope?: string;
              token_type: string;
          },
      >

      Promise resolving to OAuth tokens (preserves original refresh_token if not replaced)

      When token refresh fails or authentication is invalid