Skip to content
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

Allow custom Authorization Headers in RPC #3

Open
elementalennui-dev opened this issue Oct 2, 2024 · 1 comment
Open

Allow custom Authorization Headers in RPC #3

elementalennui-dev opened this issue Oct 2, 2024 · 1 comment

Comments

@elementalennui-dev
Copy link
Contributor

Hi @stjet!

I've been poking around with using the NanSwap Banano Node as an RPC due to it's ability to generate work. However, it requires a custom Auth header of {"nodes-api-key": NODES_API_KEY}.

It looks like in RPC.py, this code block exists:

headers = {}
#add auth header, if exists
if self.auth:
   headers['Authorization'] = self.auth
resp = requests.post(self.rpc_url, json=payload, headers=headers)

Which allows common auth headers like Bearer and JWT Tokens.

To get the NanSwap node to work, it looks like I need to submit a request with a custom header key, not Authorization.

The nano.js code has a parameter called customHeaders which allows custom key/val pairs to be set for auth headers. It would be great to have similar functionality here. Let me know your thoughts!

@stjet
Copy link
Owner

stjet commented Oct 4, 2024

Not against adding option for custom headers, but seems like Nanswap API allows the API key as a url query param now. (eg: https://nodes.nanswap.com/BAN?api_key=YOUR_API_KEY)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants