0
0
Rest APIprogramming~20 mins

Authentication documentation in Rest API - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Authentication Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this HTTP response with Bearer token?

Given this HTTP request header for authentication:

Authorization: Bearer abc123token

What is the expected server response status code if the token is valid?

A200 OK
B401 Unauthorized
C403 Forbidden
D500 Internal Server Error
Attempts:
2 left
💡 Hint

Think about what status code means success when token is valid.

🧠 Conceptual
intermediate
2:00remaining
Which authentication method uses a shared secret key?

Choose the authentication method that relies on a shared secret key between client and server.

AOAuth 2.0 Authorization Code Flow
BAPI Key Authentication
CJWT (JSON Web Token) without secret
DBasic Authentication with username only
Attempts:
2 left
💡 Hint

Think about which method requires a secret key sent or stored by both client and server.

🔧 Debug
advanced
2:00remaining
Why does this API return 401 Unauthorized despite sending a token?

Consider this HTTP request header:

Authorization: Bearer

The server responds with 401 Unauthorized. What is the most likely cause?

AThe server does not support Bearer tokens
BThe token is expired but still sent
CThe Authorization header is misspelled
DThe Bearer token is missing after the word 'Bearer'
Attempts:
2 left
💡 Hint

Check the format of the Authorization header carefully.

📝 Syntax
advanced
2:00remaining
Which Authorization header is correctly formatted for Basic Auth?

Choose the correctly formatted Authorization header for Basic Authentication with username 'user' and password 'pass'.

AAuthorization: Basic dXNlcjpwYXNz
BAuthorization: Basic user:pass
CAuthorization: Basic base64(user:pass)
DAuthorization: Basic 'dXNlcjpwYXNz'
Attempts:
2 left
💡 Hint

Remember Basic Auth requires base64 encoding of 'username:password'.

🚀 Application
expert
2:00remaining
How many scopes are granted in this OAuth 2.0 token response?

Given this OAuth 2.0 token response JSON:

{
  "access_token": "abc123",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "read write delete"
}

How many scopes does this token grant?

A2
B1
C3
D4
Attempts:
2 left
💡 Hint

Count the number of space-separated scopes in the 'scope' field.