Complete the code to specify the grant type for client credentials flow.
POST /oauth2/token HTTP/1.1 Host: authorization-server.com Content-Type: application/x-www-form-urlencoded grant_type=[1]&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET
The grant_type parameter must be set to client_credentials to use the client credentials flow.
Complete the header to specify the content type for the token request.
POST /oauth2/token HTTP/1.1 Host: authorization-server.com Content-Type: [1] grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET
The token request must use application/x-www-form-urlencoded as the content type.
Fix the error in the token request body to correctly send client credentials.
grant_type=client_credentials&client_id=[1]&client_secret=YOUR_CLIENT_SECRETThe client_id parameter must be your actual client ID string.
Complete the code to correctly parse the access token from the JSON response.
response = '{"access_token": "abc123", "token_type": "Bearer"}' data = json.loads(response) access_token = data["[1]"]
Use square brackets and the key access_token to get the token value from the JSON dictionary.
Fill all three blanks to send a POST request with client credentials and print the access token.
import requests url = 'https://authorization-server.com/oauth2/token' data = {'grant_type': '[1]', 'client_id': '[2]', 'client_secret': '[3]'} response = requests.post(url, data=data) print(response.json()['access_token'])
Use client_credentials as the grant type, and provide your client ID and secret to get the access token.