Complete the code to extract the JWT token from the HTTP Authorization header.
auth_header = request.headers.get('Authorization') token = auth_header.split(' ')[[1]]
The Authorization header usually has the format 'Bearer <token>'. Splitting by space, the token is at index 1.
Complete the code to add the JWT token to the outgoing HTTP request headers for propagation.
headers = {}
headers['Authorization'] = 'Bearer ' + [1]The variable holding the JWT token is commonly named 'token' in this context.
Fix the error in the code that forwards the JWT token in a microservice call.
response = requests.get(url, headers=[1])The requests library expects a dictionary named 'headers' for HTTP headers, not a single string or incorrect variable.
Fill both blanks to correctly extract and propagate the JWT token in a microservice environment.
auth_header = request.headers.get('[1]') token = auth_header.split(' ')[[2]]
The HTTP header for JWT tokens is 'Authorization'. The token is the second part after splitting by space, so index 1.
Fill all three blanks to create a dictionary that propagates the JWT token only if it exists and is valid.
if [1] and [2].startswith('Bearer '): headers = {'Authorization': [3] else: headers = {}
First, check if 'auth_header' exists and starts with 'Bearer '. Then extract the token part by splitting and use it in the headers.