This sample code demonstrates how to obtain an Access token using the SLB Authenticator service for a Confidential client using an Authorization Code Flow (ACF) grant using Python Flask.
NOTE : For demonstration, this sample retrieves the access token when you click on "Get Access Token" button.
- Access to SLB Developer Portal
- You need to be a member of a team on SLB Developer.
- Python 3.x is required.
- VS Code and Python Extension for VS Code.
Unzip the sample code: PythonCCGSample.zip
Open the root directory (containing app.py) of the unzipped sample code, in Visual Studio Code editor. If you are new to running the Python code using Visual Studio Code editor, refer quick start guide.
We recommend that you create a virtual environment to work with the code samples.
Refer to Creation of virtual environments in VS Code for more details. This sample is tested for using "Venv" environment type.
Make sure above created environment in activated in VS Code. The selected interpreter version will show on the right side of the status bar of Visual Studio Code editor, as shown below (python version might be different depending on your python installation). If not, refer to select and activate an environment for details.

Make sure that your pip package installer is up-to-date:
python -m pip install --upgrade pip- Install the requirements.txt file:
pip install -r requirements.txtOpen app.py file and make the following changes:
a. On line 8, set
CLIENT_ID = "[YOUR CLIENT ID]"b. On line 9, set
CLIENT_SECRET = "[YOUR CLIENT SECRET]"Note:
- Refer creation of client for using as service account for details.
Save the changes into app.py file.
Run application using the following command in Python terminal of VS Code
python -m flask runIn your web browser, go to
http://127.0.0.1:{port}. Replace{port}value with actual port value on which Flask application will run. The default port for the Flask application is 5000.Click on "Get Access Token" button on home page

Server side python code will use client id and client secret and will show the access token on web page.

- User context in SLB Digital platform
- Secret management on SLB Digital platform
- API Maturity of cloud APIs
- Refer tutorial of various solutions (e.g. FDPlan, DrillPlan, MPDF etc.) to learn more about their extensibility and how to integrate with APIs offered by these solutions into your application.