-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Summary
A token with additional newlines is not considered valid and results in a rather unhelpful error message: Failed to retrieve item: Get "http://onepassword-connect:8080/v1/vaults?filter=title+eq+%22engineering%22": net/http: invalid header field value for "Authorization". Trimming newlines would resolve the problem.
This is not a bug, because headers shouldn't contain newlines, but trimming the token string would result in a better developer-experience. It's rather easy to create such an invalid token with kubectl create secret generic op-token --from-file=token=token.txt because a lot of text editors are configured to add a trailing newline.
Use cases
Can save a few hours of debugging for anyone that doesn't follow the getting started guide exactly. In my case I integrated it into an existing Kustomize setup. Kustomize emphasises a declarative approach and loading the secret from a file is therefore not a strange approach.
Proposed solution
Please trim the token. I'd open up a PR but I'm not familiar with Go and its toolchain
Is there a workaround to accomplish this today?
Yes, remove newlines with some bash-fu
cat token.txt | tr -d "\n" > trimmed_token.txtReferences & Prior Work
n/a