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

Authenticate using the Authorization header in requests made by the cient #59

Open
lucazav opened this issue Apr 20, 2023 · 1 comment

Comments

@lucazav
Copy link

lucazav commented Apr 20, 2023

I published the GROBID server application in an Azure Web App. I added an authorisation layer using the one provided by Azure Web Apps. Now I need to authenticate the GROBID client by passing the bearer authentication token to its header requests. How can I do this?

@kermitt2
Copy link
Owner

Hi @lucazav !

This client is a simple base to be adapted on the environment requirements and there is for the moment no mechanisms to pass a bearer, you need to add it.

One simple solution is to add the bearer token defined in the config file or as environment variable secret in the header argument when calling the post() method:

https://github.com/kermitt2/grobid_client_python/blob/master/grobid_client/grobid_client.py#L278

     the_headers={"Accept": "text/plain", "Authorization": "Bearer " + self.config["bearer"] }
     try:
            res, status = self.post(
                url=the_url, files=files, data=the_data, headers=the_headers, timeout=self.config['timeout']
            )

A PR to add this is very welcome !

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

No branches or pull requests

2 participants