diff --git a/components/GraphQLExplorerPage/index.tsx b/components/GraphQLExplorerPage/index.tsx index e0aa4fc..f22f2f4 100644 --- a/components/GraphQLExplorerPage/index.tsx +++ b/components/GraphQLExplorerPage/index.tsx @@ -53,15 +53,16 @@ export const GraphQLExplorerPage = ({ source: { frontmatter } }: Props) => { const url = publicRuntimeConfig.fusionFeedUrl + '/v2/graphql'; const subscriptionUrl = publicRuntimeConfig.fusionFeedUrl + '/v2/graphql-ws'; const token = cookie.get('fftoken'); + const tokenType = token?.includes('.') ? 'Bearer' : 'token'; setFetcher(() => createGraphiQLFetcher({ headers: { - Authorization: `token ${token}`, + Authorization: `${tokenType} ${token}`, }, subscriptionUrl, url, wsConnectionParams: { - Authorization: `token ${token}`, + Authorization: `${tokenType} ${token}`, }, }), ); diff --git a/components/RESTExplorerPage/index.tsx b/components/RESTExplorerPage/index.tsx index 2a98900..21d39ad 100644 --- a/components/RESTExplorerPage/index.tsx +++ b/components/RESTExplorerPage/index.tsx @@ -23,6 +23,15 @@ const getToken = () => .find((row) => row.startsWith('fftoken=')) ?.split('=')[1]; +const getAuthorization = () => { + const token = getToken(); + if (!token) { + return ''; + } + const tokenType = token.includes('.') ? 'Bearer' : 'token'; + return `${tokenType} ${token}`; +}; + const specUrl = `${publicRuntimeConfig.fusionFeedUrl}/v2/openapi.json`; export const RESTExplorerPage = (props: Props) => { @@ -32,10 +41,9 @@ export const RESTExplorerPage = (props: Props) => {