Example website code for Slices service with OAuth¶
Authentication via OAuth¶
The Slices portal is a standards-compliant OAuth2 and OpenID Connect provider. It allows Clients (also known as Relying Parties), e.g. Slices services to verify the identity of the End-User, as well as to obtain basic profile information about the End-User in a REST-like manner.
OpenID Connect extends OAuth 2.0. The OAuth2.0 protocol provides API security via scoped access tokens, and OpenID Connect provides user authentication and single sign-on (SSO) functionality.
The Slices portal provides all OpenID Connect metadata via https://portal.slices-ri.eu/.well-known/openid-configuration.
Registering your service as an OAuth Client¶
If you want to implement a service with Slices OAuth, you need to register the following information about your service with an email to helpdesk@ilabt.imec.be:
Service Name
Service URL
One or more redirect URIs: valid callback locations where the authorization code or tokens should be sent to. (Tip: also include any redirect URIs that you want to use for your test and/or staging environments.)
Token endpoint auth method: either
client_secret_basic
orclient_secret_post
are supported. (this example will useclient_secret_post
)
We will then register your service in the portal and provide you with a client_id
and client_secret
to use. These are specific for your service.
Minimal example to login and show info on the user, projects and experiments¶
Contact us for the latest code.
Run this app with python3 app.py
and open a browser to this website, running on http://ipaddress:5000. This should give you a link to
start the Slices login procedure.
When all is fine, you should see an overview of the user and project information as shown below. Now also a part on experiments will be shown (not in the screenshot).