I am using MongoDB realm GraphQL API to access data. I am using Apollo-Angular.
The GraphQL API needs an API key to access the data. I tried with the postman and it work. Using the postman post request I pass the key in the Authorization that added in Header with the key: apiKey, value: The_Api_Key_from_Mongo
But how can I add this authorization Apollo-Angular settings?
const uri =
'https://ap-south-1.aws.realm.mongodb.com/api/client/v2.0/app/myapp_with_id/graphql';
export function createApollo(httpLink: HttpLink): ApolloClientOptions<any> {
return {
link: httpLink.create({
uri,
}),
cache: new InMemoryCache(),
};
}
Simply: I have GraphQL api uri to access this API I have to pass api key. How can I do this in Apollo-Angular?