question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to Authenticate Using Basic Auth in Dask-Gateway?

See original GitHub issue

I added an environmental variable (the password) to a docker file, and then in the helm chart, I reference the environmental variable like so:

  auth:
    # The auth type to use. One of {simple, kerberos, jupyterhub, custom}.
    type: simple

    simple:
      # A shared password to use for all users.
      password: $DASK_GATEWAY_PASSWORD

Now when I try to establish a connection and invoke BasicAuth, it still says I’m unauthorized.

auth = BasicAuth(os.environ['DASK_GATEWAY_PASSWORD'])
gateway = Gateway(
    address=os.environ['IP_ADDRESS'],
    auth=auth
)

What happened: I cannot establish a connection w/ Dask Gateway when I enter BasicAuth information; I get the following error:

ClientResponseError: 401, message='Unauthorized'

Anything else we need to know?: I am using an internal load balancer on GCP to expose the proxy server. When I wasn’t using the simple authenticator, there were no issues establishing a connection to Dask Gateway

Environment:

  • Dask-Gateway-Server version: latest
  • Python version: 3.7.8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
rileyhuncommented, Oct 23, 2020

That narrows down the problem, which is good.

A few thoughts.

Looking at the client API documentation, it looks like the BasicAuth class expects username and password kwargs. Here’s the actual code. I would try the following from the client:

 auth = BasicAuth(username=None, password=<password>)

If that doesn’t work, you can try parsing the Gateway API logs via kubectl (kubectl log -f <Gateway API pod name>).

Thanks @droctothorpe, that seemed to do the trick. That was a bad oversight on my part!

1reaction
jcristcommented, Oct 23, 2020

might benefit from an example of how to configure the client, though I defer to Jim on that.

We could always use better docs, though I think that should go in the client docs, somewhere in https://gateway.dask.org/configuration-user.html#configuration

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authentication — Dask Gateway 2022.11.0 documentation
This method implements authentication with no validation of the password field ... To do this, you'll need to create a HTTP service principal...
Read more >
dask-gateway/auth.py at main
"""Authentication hook before client request is sent. This is only called after a 401 response from the server.
Read more >
Connecting to Dask-Gateway cluster from Outside a ...
Log into the Hub (staging.hub.pangeo.io in this example) · Navigate to the Control Panel (File > Hub Control Panel) · Navigate to the...
Read more >
python/dask/dask-gateway/dask-gateway/dask_gateway/auth.py
python/dask/dask-gateway/dask-gateway/dask_gateway/auth.py ... pass class BasicAuth(GatewayAuth): """Attaches HTTP Basic Authentication to the given Request ...
Read more >
Multi-Cloud workflows with Pangeo and Dask Gateway
In [1]: import getpass import dask from distributed import. Client from dask_gateway import. Gateway. ,. BasicAuth import intake import.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found