The goal of this test is to evaluate the candidate's knowledge of working with modern authentication protocols, specifically OpenID Connect (OIDC), within the context of a mobile application. This test focuses on implementing the frontend part of the OIDC Authorization Code Flow using the provided demo server.
To successfully complete the task, the candidate is expected to demonstrate an understanding of OIDC concepts or be able to research and learn the necessary information independently. This includes, but is not limited to, working with authorization endpoints, token exchange, and securely handling tokens in a mobile application.
Candidates should familiarize themselves with the following topics:
-
OpenID Connect Overview:
-
State Management in Flutter:
-
Navigation in Flutter:
-
API Requests:
The candidate is expected to research and identify appropriate solutions independently, including:
- Using any appropriate package for OIDC integration.
- Implementing
Blocfor state management. - Configuring
go_routerfor navigation between authorized and unauthorized views. - Using
diowith interceptors to manage API requests and inject tokens.
-
Authorization via Code Flow
- Implement the Authorization Code Flow with PKCE to authenticate with the demo server.
- Use the provided native client (
interactive.public) for login. - Retrieve and securely store the access token, ID token, and refresh token upon successful authorization.
-
Protected API Access
- Use the access token to fetch data from a protected API endpoint.
- Display the retrieved data (e.g., user profile or demo-provided data) in the app.
-
Token Refresh
- Implement periodic token refresh using the refresh token.
- Automatically refresh the access token before it expires.
- Display updated tokens in the logs or UI for demonstration purposes.
-
State Management
- Use the Bloc library to handle the state of the application.
- Manage states such as unauthorized, authenticating, authorized, and token refreshing.
-
Navigation
- Use go_router for navigation.
- Redirect users to a login page if they are unauthorized.
- Navigate to the authorized home page after successful login.
-
API Requests
- Use dio to handle all API requests.
- Configure a dio interceptor to automatically inject the access token into the headers of all authorized requests.
-
Logout Functionality
- Implement a logout feature that:
- Clears stored tokens and session data.
- Redirects the user to the login page.
- Implement a logout feature that:
-
Flutter Libraries
- Use the following libraries:
- any appropriate package for OIDC flows.
flutter_blocfor state management.go_routerfor navigation.diofor API requests.
- Use the following libraries:
-
Secure Token Handling
- Store tokens securely.
- Ensure tokens are not exposed in logs or UI unnecessarily.
-
Error Handling
- Gracefully handle errors during authorization, API requests, and token refresh.
- Provide user-friendly error messages where appropriate.
-
UI/UX
- Simple and functional UI with:
- Login Page: Includes a login button to start the OIDC flow.
- Home Page: Displays user data fetched from the protected API.
- Error Notifications: Displays errors when applicable.
- Simple and functional UI with:
- Flutter Project Code
- Submit the complete Flutter project.
- Include a
README.mdwith setup instructions, including configuration of the redirect URI and running the app.
-
Functionality:
- Does the app implement the OIDC Authorization Code Flow with PKCE?
- Are authorized API requests and token refresh handled correctly?
-
Use of Libraries:
- Is
Blocused appropriately for state management? - Does
go_routerhandle navigation effectively? - Is
dioused with an interceptor to inject access tokens?
- Is
-
Code Quality:
- Is the code clean, modular, and maintainable?
- Are secure coding practices followed?
-
User Experience:
- Is the UI intuitive and functional?
- Are errors handled gracefully?
By completing this test, candidates can showcase their knowledge of OIDC, state management, navigation, and API integration in Flutter. Successful implementation will demonstrate problem-solving skills, self-learning capability, and adherence to best practices.