admin管理员组文章数量:1023585
In my front-end, I'm using the Firebase authentication and the firebaseAuth.currentUser?.getIdToken(true)
function to get the token and send it as an Authorization: Bearer {token}
header to the Google function.
I used to parse the token in the function and validate it within the function code. But I want to enable the Require authentication
setting for it.
The problem is that I receive the Your client does not have permission to the requested URL
error in this case.
I tried to set the allAuthenticatedUsers
, {project}@appspot.gserviceaccount
and firebase-service-account@firebase-sa-management.iam.gserviceaccount
principals with Cloud Functions Invoker
role, but it did not help.
Is there any way I can do so Require Authentication
is enabled, and GC allows to execute the function only for the users authenticated with the Firebase?
In my front-end, I'm using the Firebase authentication and the firebaseAuth.currentUser?.getIdToken(true)
function to get the token and send it as an Authorization: Bearer {token}
header to the Google function.
I used to parse the token in the function and validate it within the function code. But I want to enable the Require authentication
setting for it.
The problem is that I receive the Your client does not have permission to the requested URL
error in this case.
I tried to set the allAuthenticatedUsers
, {project}@appspot.gserviceaccount
and firebase-service-account@firebase-sa-management.iam.gserviceaccount
principals with Cloud Functions Invoker
role, but it did not help.
Is there any way I can do so Require Authentication
is enabled, and GC allows to execute the function only for the users authenticated with the Firebase?
- I doubt that the tokens you generate with firebase are compatible with what cloud functions expect, see cloud.google/functions/docs/securing/… and compare it with firebase.google/docs/auth/admin/verify-id-tokens The audience and sub fields have a completely different content. – somethingsomething Commented Nov 19, 2024 at 14:48
1 Answer
Reset to default 2Google Cloud IAM roles, such as "allAuthenticatedUsers" and service accounts, have nothing at all to do with Firebase Authentication user ID tokens. They aren't compatible with each other and are not interchangeable in any way. You can't simply replace your code to validate a Firebase Auth token with IAM permissions.
The only way to implement Firebase Auth token validation is using code you write, typically with the Firebase Admin SDK.
In my front-end, I'm using the Firebase authentication and the firebaseAuth.currentUser?.getIdToken(true)
function to get the token and send it as an Authorization: Bearer {token}
header to the Google function.
I used to parse the token in the function and validate it within the function code. But I want to enable the Require authentication
setting for it.
The problem is that I receive the Your client does not have permission to the requested URL
error in this case.
I tried to set the allAuthenticatedUsers
, {project}@appspot.gserviceaccount
and firebase-service-account@firebase-sa-management.iam.gserviceaccount
principals with Cloud Functions Invoker
role, but it did not help.
Is there any way I can do so Require Authentication
is enabled, and GC allows to execute the function only for the users authenticated with the Firebase?
In my front-end, I'm using the Firebase authentication and the firebaseAuth.currentUser?.getIdToken(true)
function to get the token and send it as an Authorization: Bearer {token}
header to the Google function.
I used to parse the token in the function and validate it within the function code. But I want to enable the Require authentication
setting for it.
The problem is that I receive the Your client does not have permission to the requested URL
error in this case.
I tried to set the allAuthenticatedUsers
, {project}@appspot.gserviceaccount
and firebase-service-account@firebase-sa-management.iam.gserviceaccount
principals with Cloud Functions Invoker
role, but it did not help.
Is there any way I can do so Require Authentication
is enabled, and GC allows to execute the function only for the users authenticated with the Firebase?
- I doubt that the tokens you generate with firebase are compatible with what cloud functions expect, see cloud.google/functions/docs/securing/… and compare it with firebase.google/docs/auth/admin/verify-id-tokens The audience and sub fields have a completely different content. – somethingsomething Commented Nov 19, 2024 at 14:48
1 Answer
Reset to default 2Google Cloud IAM roles, such as "allAuthenticatedUsers" and service accounts, have nothing at all to do with Firebase Authentication user ID tokens. They aren't compatible with each other and are not interchangeable in any way. You can't simply replace your code to validate a Firebase Auth token with IAM permissions.
The only way to implement Firebase Auth token validation is using code you write, typically with the Firebase Admin SDK.
本文标签: Use http Google Cloud Functions quotRequire Authenticationquot with FirebaseStack Overflow
版权声明:本文标题:Use http Google Cloud Functions "Require Authentication" with Firebase - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745568736a2156606.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论