Extract token from login response and use it in next API request
Preconditions (3)
Step 1: Send a POST request to https://api.example.com/login with JSON body {"username": "testuser", "password": "testpass"}
Step 2: Verify the response status code is 200
Step 3: Extract the 'token' value from the JSON response body
Step 4: Send a GET request to https://api.example.com/profile
Step 5: Add an Authorization header with the value 'Bearer <extracted_token>'
Step 6: Verify the response status code is 200
Step 7: Verify the response body contains the username 'testuser'
✅ Expected Result: The login request returns a token, which is used in the Authorization header of the profile request. The profile request succeeds and returns user details including username 'testuser'.