MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / authInfoHandler

Function authInfoHandler

endpoints/getting-started/app.js:33–40  ·  view source on GitHub ↗
(req, res)

Source from the content-addressed store, hash-verified

31});
32
33const authInfoHandler = (req, res) => {
34 let authUser = {id: 'anonymous'};
35 const encodedInfo = req.get('X-Endpoint-API-UserInfo');
36 if (encodedInfo) {
37 authUser = JSON.parse(Buffer.from(encodedInfo, 'base64'));
38 }
39 res.status(200).json(authUser).end();
40};
41
42app.get('/auth/info/googlejwt', authInfoHandler);
43app.get('/auth/info/googleidtoken', authInfoHandler);

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected