Skip to content

client: Add OpenID Connect bearer token authentication

By providing a refresh token, obtained with the swh auth login command to the new authenticate method of the client, all emitted requests will be authenticated using a bearer token sent in headers.

Example of use:

from swh.web.client import WebAPIClient

REFRESH_TOKEN = '.......'  # Use "swh auth login" command to get it

client = WebAPIClient()
client.authenticate(REFRESH_TOKEN)

# All requests to the Web API will be authenticated
resp = client.get('swh:1:rev:aafb16d69fd30ff58afdd69036a26047f3aebdc6')

Depends on !2 (closed)

Related to swh-web#1927 (closed)


Migrated from D2869 (view on Phabricator)

Merge request reports