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

feat: allow for Authorization header override with raw parameter #2432

Merged
merged 1 commit into from
May 25, 2023

Conversation

kristian1108
Copy link
Contributor

This PR creates a Raw Authorization type which allows the user to set the full Authorization header in a websocket request if the server they are connecting to does not conform to Bearer or Basic auth.

Motivation

Solution

PR Checklist

  • [trivial change ] Added Tests
  • [x ] Added Documentation
  • [ no] Breaking changes

@kristian1108 kristian1108 changed the title allow for Authorization header override with raw parameter feat: allow for Authorization header override with raw parameter May 25, 2023
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is reasonable imo

@kristian1108
Copy link
Contributor Author

I'm not sure what these test failures are ... is it possible they're flaky? Or maybe I missed something...

Copy link
Collaborator

@DaniPopes DaniPopes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Don't worry about the CI

@DaniPopes DaniPopes merged commit 007c58b into gakonst:master May 25, 2023
13 of 15 checks passed
@weezy20
Copy link

weezy20 commented Aug 21, 2023

I have an issue where I cannot get this enum variant to work as intended. My WSS endpoint expects a custom header and an api key, and if I provide it using Authroization::raw, I just get a HTTP 403. The reason this is strange is because on an equivalent js app using web3-providers-ws, we are able to instantiate the ws connection correctly using our custom headers :

const customWsProvider = new WebSocketProvider(WS_URL, {
  headers: {
    'KEY' : val
  },
})

in my experience the equivalent ethers-rs code is not totally equivalent:

let api_key = // .. ;
let auth = Authorization::raw(format!("KEY {api_key}"));
let provider = Provider::<Ws>::connect_with_auth(url, auth).await?

Any help would be appreciated.

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

Successfully merging this pull request may close these issues.

None yet

4 participants