the-nft-company / flow-jvm-sdk

Apache License 2.0
13 stars 25 forks source link

Ability to add basic auth credentials while creating newAccessApi #29

Open ajayane opened 9 months ago

ajayane commented 9 months ago

I am connecting to the FLOW blockchain nodes through over GRPC, using the Flow SDK on Java, the server needs a basicAuth to be send while creating the client.

Flow.newAccessApi doesnt support any credentials to be passed or setting the secure=true doesn't work.

I am hoping there must be a way to provide the credentials while calling the Flow.newAccessApi, Like in Go they have a

grpc.Dial(target,
        grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
        grpc.WithPerRPCCredentials(basicAuth{
            username: endpoint,
            password: token,
 })

I am hoping this feature could be helpful for developers

ajayane commented 9 months ago

This seems to be achieved by attaching an interceptor and providing the Metadata headers. But there should by a way to provide the interceptors to Flow.newAccessApi