-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing claim 'kid' in auth header. #12
Comments
Hi, I'll check this tomorrow. In the mean time, could you please let me know if this is only for some latest setting, not that this breaks everything? |
Since I no longer use firebase, could you please let me know if this is the only thing we need to change? https://firebase.google.com/docs/auth/server#use_a_jwt_library |
I am using PHP-JWT to generate the token. Where does this kid go? Can anybody kindly help?
Is it supposed to be inside claims or is it supposed to be at the same level as uid? |
For future reference. I got Firebase 3.0 working like this: You get this service account manifest JSON through Google's IAM console. {
"type": "service_account",
"project_id": "..redacted..",
"private_key_id": "..redacted..",
"private_key": "-----BEGIN PRIVATE KEY-----\n...redacted...\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "12340000000000000000",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/..."
} def generate_web_token(uid, claims)
# Parses Google's `service_account` JSON file into an array
service_data = get_service_data()
private_key = OpenSSL::PKey::RSA.new(service_data['private_key'])
service_account_email = service_data['client_email']
now_seconds = Time.now.to_i
payload = {
iss: service_account_email,
sub: service_account_email,
aud: 'https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit',
iat: now_seconds,
exp: now_seconds + (60 * 60),
uid: uid,
claims: claims,
kid: data['private_key_id']
}
private_key = OpenSSL::PKey::RSA.new(service_data['private_key'])
# Generate JWT
JWT.encode(payload, private_key, 'RS256')
end My other findings:
Hope this helps. |
@godfat thanks for the fix! I'll try to find time to test it tomorrow, it looks like it'll work. Also reference for everybody: 2.4.X version of Firebase will be supported for some time according to devs. |
I am passing it as you described - It should work. However, it does not work :( It still gives me a 400 Bad Request saying Invalid claim 'kid' in auth header. And there is no documentation on kid in the Firebase Docs. Now I'm starting to get worried. Such a waste of time for such a simple thing. Thanks for the answer, buddy. |
@jrasanen I didn't figure out how to solve that kid issue for that commit and I can't find any document for that either :( Fortunately you found it! I'll try your approach in the next few days. Thanks! Bottom line: As long as you could pass auth for rest-firebase, I guess it would still work for 3.0. @jrm1987 Oh, sorry about that :( They said they would improve the doc. |
It didn't work for me either. However, I tried to put a {"error"=>"Invalid claim 'kid' in auth header."} I tried to give |
@katowulf Thanks! I still don't get it though. Still getting Questions:
|
Firebase support team wrote me today that they are looking into the error
|
Meh, the code which I was using as a workaround stopped working and Google/Firebase started returning: {
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "INVALID_CUSTOM_TOKEN"
}
],
"code": 400,
"message": "INVALID_CUSTOM_TOKEN"
}
} |
Thanks for the update!! I guess our best bet for now is just waiting, unless it's urgent to adopt... |
Waiting is good, too bad though. Firebase seriously needs a debug console, so devs can see what is happening on their side. |
Hi any update on the issue @breft did you got a response from firebase guys |
Original post: http://stackoverflow.com/questions/39117237/firebase-rest-with-auth-query-param-not-working
|
i am fetching the products for a specific user in this way:
but i am getting this response:
can any one help me please |
Any update on this issue |
Unfortunately, nothing from me
|
Same with kreait/firebase-php#169 (comment) |
I solved my this same type of error adding |
On Firebase 3.0 I get an error
"Missing claim 'kid' in auth header."
Apparently now Firebase requires private key's id supplied with claims.
The text was updated successfully, but these errors were encountered: