Challenge - 5 Problems
OAuth Integration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate2:00remaining
What happens after successful OAuth callback in Rails?
In a Rails app using OAuth, after the user authorizes the app and the OAuth provider redirects back, what is the typical next step in the controller handling the callback?
Attempts:
2 left
💡 Hint
Think about what the app needs to do to get permission to act on the user's behalf.
✗ Incorrect
After OAuth provider redirects back with a code, the app must exchange it for an access token to authenticate the user and create or update the session.
📝 Syntax
intermediate2:00remaining
Identify the correct OmniAuth middleware setup in Rails
Which of the following is the correct way to configure OmniAuth middleware for GitHub OAuth in a Rails app's config/initializers/omniauth.rb?
Attempts:
2 left
💡 Hint
Check the exact method to add middleware in Rails application config.
✗ Incorrect
The correct syntax uses Rails.application.config.middleware.use to add OmniAuth::Builder with the provider block.
🔧 Debug
advanced2:00remaining
Why does the OAuth callback fail with 'invalid redirect_uri' error?
A Rails app using OAuth gets an 'invalid redirect_uri' error from the provider during callback. What is the most likely cause?
Attempts:
2 left
💡 Hint
OAuth providers require exact URL matches for security.
✗ Incorrect
OAuth providers check that the redirect_uri in the request matches exactly what was registered to prevent malicious redirects.
❓ state_output
advanced2:00remaining
What is stored in session after OAuth login?
After a successful OAuth login in a Rails app, which of the following is the most common data stored in the session?
Attempts:
2 left
💡 Hint
Think about what minimal info is needed to keep the user logged in securely.
✗ Incorrect
Storing only the user ID in session is secure and sufficient to identify the user; tokens are usually stored encrypted in the database if needed.
🧠 Conceptual
expert3:00remaining
Why use OAuth scopes in integration?
In OAuth integration, why do apps request specific scopes during authorization?
Attempts:
2 left
💡 Hint
Think about why apps ask for permission to access only some data, not everything.
✗ Incorrect
Scopes define what data or actions the app can access, helping users control their privacy and limiting app permissions.