Immutable solution version
How to protect firebase Cloud Function HTTP endpoint to allow only Firebase authenticated users?
Complete solution
How to protect firebase Cloud Function HTTP endpoint to allow only Firebase authenticated users?: There is an official code sample for what you're trying to do.
[Doug Stevenson (accepted answer)] There is an official code sample for what you're trying to do. What it illustrates is how to set up your HTTPS function to require an Authorization header with the token that the client received during authentication. The function uses the firebase-admin library to verify the token. Also, you can use "callable functions" to make a lot of this boilerplate easier, if your app is able to use Firebase client libraries.
Context: Stack Overflow #42751074 (accepted answer, 228 votes, 10 answers): With the new firebase cloud function I've decided to move some of my HTTP endpoint to firebase. Everything works great... But i have the following issue. I have two endpoints build by HTTP Triggers (Cloud Functions) - An API endpoint to create users and returns the custom Token generated by Firebase Admin SDK. - An API endpoint to fetch certain user details. While the first endpoint is fine, but for my second end point i would want to protect it for authenticated users only. meaning someone who has the token i generated earlier. How do i go about solving this? I know we can get the Heade
Matched source
Source: Published skill Original query: "How to protect firebase Cloud Function HTTP endpoint to allow only Firebase authenticated users?" Key terms: allow, authenticated, cloud, endpoint, firebase, function, http, only, protect, users
Evidence
Source: Stack Overflow #42751074 (accepted answer, 228 votes, 10 answers): With the new firebase cloud function I've decided to move some of my HTTP endpoint to firebase. Everything works great... But i have the following issue. I have two endpoints build by HTTP Triggers (Cloud Functions) - An API endpoint to create users and returns the custom Token generated by Firebase Admin SDK. - An API endpoint to fetch certain user details. While the first endpoint is fine, but for my second end point i would want to protect it for authenticated users only. meaning someone who has the token i generated earlier. How do i go about solving this? I know we can get the Heade
Verified resolution: [Doug Stevenson (accepted answer)] There is an official code sample for what you're trying to do. What it illustrates is how to set up your HTTPS function to require an Authorization header with the token that the client received during authentication. The function uses the firebase-admin library to verify the token. Also, you can use "callable functions" to make a lot of this boilerplate easier, if your app is able to use Firebase client libraries.
Source URL: https://stackoverflow.com/questions/42751074
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_i9ikD_U_9A9UYWa_OYGLYQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">How to protect firebase Cloud Function HTTP endpoint to allow only Firebase authenticated users? <span>— Vectle</span></a>