ExamGecko
Question list
Search
Search

Question 450 - 200-901 discussion

Report
Export

A resource named /item is protected by oAuth2 authentication. An endpoint named /login must request authentication. Which method must be used to access the resource by using the REST API?

A.

Make a GET call to /login that includes the username and password, and retrieve a token to insert into the /item call.

Answers
A.

Make a GET call to /login that includes the username and password, and retrieve a token to insert into the /item call.

B.

Make a POST call to /login including the user credentials in the message, and retrieve a token to insert into the authorization header of the /item call.

Answers
B.

Make a POST call to /login including the user credentials in the message, and retrieve a token to insert into the authorization header of the /item call.

C.

Make a GET call to /item, then make a call to /login that includes the username and password in the body of the message, and wait for the authorization code.

Answers
C.

Make a GET call to /item, then make a call to /login that includes the username and password in the body of the message, and wait for the authorization code.

D.

Make a POST call to /item that includes the username and password in the body of the request message, and submit it to request access.

Answers
D.

Make a POST call to /item that includes the username and password in the body of the request message, and submit it to request access.

Suggested answer: B

Explanation:

When using OAuth2 authentication for accessing a protected resource via a REST API, the typical flow involves obtaining an access token which can then be used to authenticate subsequent API requests. The correct process is:

POST Call to /login: Make a POST request to the /login endpoint with the user credentials (username and password) in the request body. This call will authenticate the user and, if successful, return an access token.

Use the Token: Use the retrieved token by including it in the Authorization header (usually as a Bearer token) in the request to access the protected resource, in this case, the /item endpoint.

OAuth 2.0 Authorization Framework - RFC 6749

asked 07/10/2024
Brian Lester
33 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first