Comments (6)
Hi Carson,
I tried tampering with the master key by deleting some of the chars and I was getting:
HTTPFailure: Status code: 401
{"code":"Unauthorized","message":"The input authorization token can't serve the request. Please check that the expected payload is built as per the protocol, and check the key being used. Server used the following payload to sign: 'get\ndbs\n\nwed, 11 nov 2015 06:30:31 gmt\n\n'\r\nActivityId: ef1b4818-5541-4b92-8455-786735288abd"}
Can you give an example of the invalid master key that gives you that exception?
Regards,
Rajesh
from azure-cosmos-python.
Hey Rajesh - something like "xxxxx" or the existing dummy value of "[YOUR_KEY_HERE]" triggers the exception.
from azure-cosmos-python.
I get the same Error: Incorrect padding
when I haven't entered the [YOUR_KEY_HERE]
& [YOUR_ENDPOINT_HERE]
.
from azure-cosmos-python.
@rnagpal it's because of auth.py
__GetAuthorizationTokenUsingMasterKey
here it does:
key = master_key.decode('base64')
If the invalid master key doesn't decode from base64 correctly, then you get the error: Error: Incorrect padding
, but the stacktrace is not correct due to the try/except
backoff_retry_utility.Execute
which catches any exception and doesn't re-raise the caught exception e
and instead does an empty raise
.
from azure-cosmos-python.
@RedCraig We had fixed this stack trace issue sometimes in Jan this year, so the stack trace shown in the initial thread now shows as:
File "F:\DocDB-Main1\Product\SDK\python\python\pydocumentdb\auth.py", line 37, in GetAuthorizationHeader
document_client.master_key)
File "F:\DocDB-Main1\Product\SDK\python\python\pydocumentdb\auth.py", line 61, in __GetAuthorizationTokenUsingMasterKey
key = master_key.decode('base64')
File "C:\Python27\lib\encodings\base64_codec.py", line 42, in base64_decode
output = base64.decodestring(input)
File "C:\Python27\lib\base64.py", line 321, in decodestring
return binascii.a2b_base64(s)
Error: Incorrect padding
We were doing "raise e" earlier which didn't showed the complete stack trace. But now that has been changed to "raise"(empty raise) which does shows the complete stack trace that I pasted above.
I see that you have a PR to fix this annoying message for someone just coming in and running the tests as is. Thanks!
from azure-cosmos-python.
@rbcarson : @RedCraig had fixed this issue by submitting a PR which has been merged. Closing this issue.
from azure-cosmos-python.
Related Issues (20)
- Query Partitioned Collection HOT 4
- Documentation outdated
- ChangeFeed gets all the history records instead of current record.
- How to send a query or stored procedure execution to a specific region/location ? HOT 1
- Documentation does not include how to create a database with provisioned throughput
- No method get_database_client in CosmosClient HOT 2
- pydocumentdb 2.3.5 install failed with homebrew HOT 3
- synchronized_request._Request is_media sniff bug HOT 1
- When can we expect 4.* release? HOT 2
- Documentation is broken due to bad doc string
- SQL queries with DISTINCT and ORDER BY does not work
- old version pydocumentdb source code is missing
- Missing information HOT 1
- SyntaxWarning: "is not" with a literal
- AttributeError: 'CosmosClient' object has no attribute 'ExecuteStoredProcedure' HOT 5
- Moving to a new repo HOT 2
- enable autoscaling for database HOT 1
- Using Python to connect to cosmosDB throws Authorization header doesn't confirm to the required format HOT 2
- Python SDK - Update Autoscale Throughput HOT 1
- This repo is missing important files HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-cosmos-python.