Pass auth token in Apollo gateway

I tried to set up a gateway following example here: supergraph-demo-fed2/gateway.js at main · apollographql/supergraph-demo-fed2 · GitHub

I have managed federation graph and the gateway connected to that graph.
My graph need authentication, but the auth token can’t be passed to the graph when I query through the gateway.
Then I tried to set up the context when I created the ApolloServer with the code below, but I got error saying " Cannot read property ‘headers’ of undefined", so seems the request doesn’t pass through the ApolloServer correctly.
Want to see if anyone have any suggestion, thank you!

const server = new ApolloServer({
  gateway,
   context: ({request}) => {
    const {
        principalToken,
    } = request.headers.authorization;
    return {
        headers: request.headers,
        principalToken
    };