exception: Failed to validate Mac
See original GitHub issueAfter I set a rule which allow some user to write to Firebase, a exception was thrown.
It is ok with the iOS SDK, but python will crash.
code:
f = firebase.FirebaseApplication('https://glowing-fire-xxxx.firebaseIO.com', None)
f.authentication = firebase.FirebaseAuthentication('xxxx', 'xxxx@hotmail.com')
ref = "/v/2/vd"
f.put(ref,"2016","a:3:5") // throw exception
the rule:
{
"rules": {
".read": true,
"v":{
".read": true,
".write": "auth != null&&auth.uid=='xxx-xxx-af2d'"
}
}
}
exception:
_content = {str} '{\n "error" : "Failed to validate MAC."\n}\n'
_content_consumed = {bool} True
apparent_encoding = {str} 'ascii'
connection = {HTTPAdapter} <requests.adapters.HTTPAdapter object at 0x110fc8790>
content = {str} '{\n "error" : "Failed to validate MAC."\n}\n'
cookies = {RequestsCookieJar} <RequestsCookieJar[]>
elapsed = {timedelta} 0:00:01.277145
encoding = {str} 'utf-8'
headers = {CaseInsensitiveDict} CaseInsensitiveDict({'content-length': '42', 'strict-transport-security': 'max-age=31556926; includeSubDomains; preload', 'content-type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})
history = {list} []
links = {dict} {}
ok = {bool} False
raw = {HTTPResponse} <requests.packages.urllib3.response.HTTPResponse object at 0x110fdffd0>
reason = {str} 'Bad Request'
request = {PreparedRequest} <PreparedRequest [PUT]>
status_code = {int} 400
text = {unicode} u'{\n "error" : "Failed to validate MAC."\n}\n'
url = {unicode} u'https://xxx.firebaseIO.com/v/2/vd/2016.json?auth=eyJhbGciOiAiSFMyNTYiLCAidasdfG1pbiI6IGZhbHNlLCAiZGVidWciOiBmYWxzZSwgImlhdCI6IDE0NTcxMzI2MjEsICJkIjogeyJkZWJ1ZyI6IGZhbHNlLCAiYWRtaW4iOiBmYWxzZSwgImVtYWlsIjogImltcW
Traceback
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 2411, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1802, in run
launch(file, globals, locals) # execute the script
File "/Users/xxx/script/xxxx.py", line 373, in <module>
f.put(ref,xxx,xxx)
File "/Library/Python/2.7/site-packages/firebase/decorators.py", line 19, in wrapped
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/firebase/firebase.py", line 302, in put
connection=connection)
File "/Library/Python/2.7/site-packages/firebase/decorators.py", line 19, in wrapped
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/firebase/firebase.py", line 72, in make_put_request
response.raise_for_status()
File "/Library/Python/2.7/site-packages/requests/models.py", line 683, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 2411, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1802, in run
launch(file, globals, locals) # execute the script
File "/Users/huifengqi/workspace/xxx/script/myFile.py", line 373, in <module>
f.put(ref,ds2,hp.retVerse)
File "/Library/Python/2.7/site-packages/firebase/decorators.py", line 19, in wrapped
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/firebase/firebase.py", line 302, in put
connection=connection)
File "/Library/Python/2.7/site-packages/firebase/decorators.py", line 19, in wrapped
return f(*args, **kwargs)
File "/Library/Python/2.7/site-packages/firebase/firebase.py", line 72, in make_put_request
response.raise_for_status()
File "/Library/Python/2.7/site-packages/requests/models.py", line 683, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:11
Top Results From Across the Web
Firebase: INVALID_TOKEN: Failed to validate MAC
MAC in this context stands for Message Authentication Code. It means that the the contents of the authentication token were not properly signed....
Read more >Why: Unable to validate your appli… | Apple Developer Forums
The package is "valid on disk" and "satisfies all requirements" when checked. So it's signed correctly.
Read more >Failed to validate MAC - Google Groups
I tried to test the endpoint to read data from firebase database, the images below show how I configured the rules, I fetch...
Read more >Resolving view state message authentication code (MAC) errors
A MAC validation error will resemble the following example: Server Error in '/' Application. Validation of viewstate MAC failed. If this application is...
Read more >AutoCAD LT for Mac 2023 | Autodesk Knowledge Network
2020-12-29T11:18:16.320 [Install Manager: 1423, 0x110e9fe00] [BootstrapUI ERROR] [ ExecuteCommand ] BS_ERROR_703! Failed to validate the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @ShreedharHM under Project Settings, the second tab. The url should looks something like
So, actually it works fine even like this, with all the sign-in provider disabled
I was erroneously using the “Web Api Key” under “General” tab, while the correct is the one in the “Database” tab. Morever here is explicetely stated