the fact that .auth/me works but your function doesn't is a huge clue. the .auth/me endpoint just reads the encrypted cookie that easy auth sets, but your function is trying to validate the JWT token directly from the header. that's two different authentication mechanisms.
when you use AuthorizationLevel.User in your function, it expects a valid JWT token in the Authorization header with the Bearer scheme. it doesn't use the X-ZUMO-AUTH header. that header is for the mobile client sdks.
so, instead of putting your token in the X-ZUMO-AUTH header, try this. add an Authorization header with the value Bearer <your_id_token>. your function should then validate the signature of that JWT against the google issuer.
but wait, you said JWT.IO says the signature is invalid. that's the real problem right there. if the signature is invalid, azure functions will reject it and return a 401. this usually means the JWT wasn't signed correctly, or the key used to sign it isn't available for validation.
since you're using google, make sure you configured the client id and secret correctly in your easy auth settings. also, check that the token you're using is the id_token and not an access_token. easy auth and your function need the id token.
this might help in other scenarios too, always use the id token for authentication.
aha, and here's another thing. the Allowed external redirect URLs field in the google auth setup needs to include your function's callback url. it should be something like https://<your-function>.azurewebsites.net/.auth/login/google/callback. if that's missing, the token might not be issued correctly.
also, give this microsoft doc a quick read. it explains how the tokens flow with easy auth. https://learn.microsoft.com/en-us/azure/app-service/overview-authentication-authorization
hope this gets you past that 401 error. swapping that header should do the trick. let me know if it works.
Best regards,
Alex
and "yes" if you would follow me at Q&A - personaly thx.
P.S. If my answer help to you, please Accept my answer