Beta

Create a tenant

A new tenant starts with its own users, OAuth settings, audit history and logs. You are its first Tenant Admin.

BTL Admin

Codes, links, and approval prompts

Another way to sign in

After entering a password at Cedar Inc., Alex is asked for a code. On another site, Alex can sign in by clicking a link sent by email. Both methods rely on a short-lived secret, but the way Alex receives it and the checks the service performs can differ.

Authenticator-app codes

An authenticator app generates codes without waiting for a new message. During enrollment, the service and app receive the same secret, often through a QR code. If someone copies that enrollment code, they may be able to generate Alex's future sign-in codes too.

Time-based one-time passwords (TOTP) use the shared secret and the current time to calculate a short code. The service calculates the expected code independently. In the next lesson, public-key methods will work differently: the service will not hold the private key that produces the response.

Because clocks can differ slightly, the service may accept codes within a small time window. It also limits guesses and must not accept a code again after a successful use. If Alex types a current code into a fake site, however, someone can relay it to the real service before it expires. A changing code is still something a phishing page can ask for.

Approval prompts

Instead of asking Alex to type a code, a service can send an approval request to an enrolled app. The response must come from that app and belong to the sign-in attempt Alex is completing.

If someone else starts a sign-in with Alex's password, Alex might receive a prompt without expecting one. Repeated prompts can wear people down. Number matching and details about the request can help Alex notice a mismatch, but they cannot stop someone from approving a request they did not start.

Alex should deny an unexpected prompt and investigate through a trusted route. If the request is denied, expires, or cannot reach the app, the sign-in attempt has not succeeded.

Following a code

Here is a simulated request for a delivered code. The address and values are fictional; the example does not send a real request.

POST https://login.cedar.example/sign-in/verify-code
Content-Type: application/json

{"attempt_id":"example-attempt","code":"000000"}

HTTP/1.1 400 Bad Request
Content-Type: application/json

{"error":"Code could not be accepted. Start a new attempt."}

Suppose those digits match a code sent earlier, but the sign-in attempt has expired. The response rejects it. Matching digits alone would not be enough; the service also needs to check:

Checks in the delivered-code example
CheckWhy it matters
Account and purposeA recovery code must not accidentally become a sign-in or email-change approval.
Pending attemptEvidence must complete the intended interaction.
Lifetime and unused stateAn expired or consumed secret must fail, including concurrent reuse.
Guess limitsA short code has a small search space and needs abuse controls.

Try it in the Lab

PUT IT INTO PRACTICE

Check your understanding

Try these questions before moving on. If an answer isn't right, use the feedback and try again.

0 of 2 answered correctly

Enable JavaScript to answer these questions and save progress in this browser.

QUESTION 1 OF 2Alex enters an expired sign-in code correctly. What should happen?

QUESTION 2 OF 2Alex gets an approval prompt without starting a sign-in. What is the appropriate response?

We value your privacy

We use cookies and similar technologies to enhance your browsing experience, and analytics to understand our traffic. By clicking "Allow All", you consent to optional analytics. Cookie Policy

Learn identity