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

Add support for API auth with access token #482

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nuwang
Copy link
Member

@nuwang nuwang commented Nov 10, 2023

Depends on: galaxyproject/galaxy#16977

This is the line where the tus client seems to rely on x-api-key that I mentioned @mvdbeek:

headers = {"x-api-key": self.key}

@nuwang nuwang force-pushed the add_support_for_access_tokens branch from 4ae8b13 to e227bdf Compare November 10, 2023 13:43
bioblend/galaxyclient.py Outdated Show resolved Hide resolved
@nuwang nuwang force-pushed the add_support_for_access_tokens branch 2 times, most recently from 516eceb to 3721c55 Compare November 12, 2023 09:47
@nuwang nuwang force-pushed the add_support_for_access_tokens branch from 3721c55 to 7b1f50d Compare November 12, 2023 11:15
@nuwang nuwang force-pushed the add_support_for_access_tokens branch from 7b1f50d to 09b340f Compare November 12, 2023 11:17
Copy link
Member

@nsoranzo nsoranzo left a comment

Choose a reason for hiding this comment

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

I guess something will need to be done also for the tus upload https://github.com/galaxyproject/bioblend/blob/main/bioblend/galaxyclient.py#L330 ?

Ping @natefoo

@nsoranzo
Copy link
Member

nsoranzo commented Jul 9, 2024

@nuwang Do you want to rebase this now that the Galaxy PR has been merged?

Comment on lines +77 to +78
elif token:
self.token: Optional[str] = token
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
elif token:
self.token: Optional[str] = token

else:
self._key = None
self.email = email
self.password = password
self.json_headers: dict = {"Content-Type": "application/json"}
# json_headers needs to be set before key can be defined, otherwise authentication with email/password causes an error
self.json_headers["x-api-key"] = self.key
if token:
self.json_headers["Authorization"] = f"Bearer {self.token}"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.json_headers["Authorization"] = f"Bearer {self.token}"
self.json_headers["Authorization"] = f"Bearer {token}"

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.

2 participants