0
0
Postmantesting~20 mins

Basic authentication in Postman - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Basic Auth Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What does Basic Authentication encode?
In Basic Authentication, what is the format of the encoded string sent in the Authorization header?
AMD5 hash of the username only
BBase64 encoding of username and password joined by a colon
CPlain text username and password separated by a comma
DSHA256 hash of the password only
Attempts:
2 left
💡 Hint
Think about how username and password are combined before encoding.
Predict Output
intermediate
2:00remaining
What is the Authorization header value?
Given username 'user1' and password 'pass123', what is the correct Authorization header value in Basic Authentication?
Postman
import base64
credentials = 'user1:pass123'
encoded = base64.b64encode(credentials.encode()).decode()
print(f'Basic {encoded}')
ABasic dXNlcjE6cGFzczEyMw==
BBasic dXNlcjE6cGFzczEyMw
CBasic dXNlcjE7cGFzczEyMw==
DBasic dXNlcjE6cGFzczEyMw===
Attempts:
2 left
💡 Hint
Check the exact Base64 encoding of 'user1:pass123'.
locator
advanced
1:30remaining
Identify the correct Postman setting for Basic Auth
Where in Postman do you set the username and password for Basic Authentication?
AUnder the Authorization tab, select 'Basic Auth' and enter username and password fields
BIn the Headers tab, manually add 'Authorization' header with encoded value
CIn the Params tab, add username and password as query parameters
DIn the Body tab, add username and password as form-data
Attempts:
2 left
💡 Hint
Postman has a dedicated place for authentication types.
assertion
advanced
1:30remaining
Which test script assertion verifies Basic Auth success?
In Postman test scripts, which assertion correctly checks that the server accepted Basic Authentication by returning status 200?
Postman
pm.test('Basic Auth success', () => {
    pm.response.to.have.status(200);
});
Apm.test('Basic Auth success', () => { pm.response.to.have.status(500); });
Bpm.test('Basic Auth success', () => { pm.response.to.have.status(401); });
Cpm.test('Basic Auth success', () => { pm.response.to.have.status(200); });
Dpm.test('Basic Auth success', () => { pm.response.to.have.status(404); });
Attempts:
2 left
💡 Hint
Success means HTTP 200 OK status.
🔧 Debug
expert
2:30remaining
Why does this Postman Basic Auth test fail?
This Postman test script fails even though the username and password are correct. What is the likely cause? pm.test('Check Auth', () => { pm.response.to.have.status(200); pm.expect(pm.request.headers.get('Authorization')).to.eql('Basic dXNlcjE6cGFzczEyMw=='); });
AThe Authorization header value is case sensitive and must be 'basic' lowercase
BThe Authorization header is automatically removed by Postman before sending
CThe Authorization header value includes 'Basic ' prefix, missing in the assertion
DThe Authorization header value is dynamic and should be retrieved from pm.request.headers without hardcoding
Attempts:
2 left
💡 Hint
Check how the Authorization header is accessed and compared in the test.