Challenge - 5 Problems
Federated Authentication Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What is the main purpose of federated authentication?
Choose the best description of federated authentication.
Attempts:
2 left
💡 Hint
Think about how users can use one login for many services.
✗ Incorrect
Federated authentication lets users sign in with one account from a trusted provider, like Google or Facebook, to access multiple services without creating new passwords.
❓ query_result
intermediate2:00remaining
What is the output of this GraphQL query for federated user info?
Given this GraphQL query requesting user email and provider, what is the expected JSON response?
GraphQL
query {
user(id: "123") {
email
authProvider
}
}Attempts:
2 left
💡 Hint
The user exists and uses Google as their login provider.
✗ Incorrect
The query requests both email and authProvider fields. The user exists, so both fields return valid values.
📝 Syntax
advanced2:00remaining
Which GraphQL schema snippet correctly defines a federated user type with an external key?
Select the valid GraphQL SDL code that defines a federated User type with an external key.
Attempts:
2 left
💡 Hint
The @key directive requires quoted field names and non-null id.
✗ Incorrect
The @key directive must have quoted field names. The id field must be non-nullable (ID!). Option A follows both rules.
❓ optimization
advanced2:00remaining
How to optimize federated GraphQL queries to reduce data fetching overhead?
Which approach best reduces unnecessary data fetching in a federated GraphQL service?
Attempts:
2 left
💡 Hint
Think about how to tell the gateway what fields are needed for resolving.
✗ Incorrect
The @requires directive helps specify which fields are needed from other services, so the gateway fetches only necessary data, improving efficiency.
🔧 Debug
expert3:00remaining
Why does this federated GraphQL query fail with a 'Cannot query field' error?
Given this query:
query {
user(id: "123") {
id
email
profilePicture
}
}
And the User type schema:
type User @key(fields: "id") {
id: ID!
email: String
}
Why does querying profilePicture cause an error?
Attempts:
2 left
💡 Hint
Check if the requested field exists in the schema.
✗ Incorrect
The error occurs because profilePicture is not declared in the User type schema, so GraphQL rejects the query for that field.