Skip to content

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

Open

Description

@lucazav

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?

Activity

  1. kermitt2 commented on Apr 20, 2023

    @kermitt2
    Collaborator

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions