Web3.swift icon indicating copy to clipboard operation
Web3.swift copied to clipboard

How can I do a Basic Auth in Web3?

Open DwCleb opened this issue 5 years ago • 1 comments

I need apply user and password in some endpoints in my request.

How can I pass a user and password in this request?

DwCleb avatar Aug 13 '20 14:08 DwCleb

You can create your own Web3Provider. Have a look at https://github.com/Boilertalk/Web3.swift/blob/master/Sources/FoundationHTTP/Web3HttpProvider.swift for an example. You can pretty much copy & paste it and add the Basic Auth for URLRequest.

Then you would only have to provide your own Provider to the Web3 initializer here:

https://github.com/Boilertalk/Web3.swift/blob/master/Sources/Core/Web3/Web3.swift#L52

koraykoska avatar Oct 01 '20 16:10 koraykoska