Build a Teacher-Facing Roster App
Use Clever SSO and Secure Sync to authenticate teachers and show their classes and students.
Build a teacher-facing app that uses Clever SSO to identify a teacher and Secure Sync to retrieve that teacher’s classes and students.
Prerequisites
- Configure SSO and Secure Sync for your application.
- Configure a production HTTPS redirect URI.
- Store the district-app token for each connected district.
Understand the two-token flow
Use the OAuth user access token to identify the teacher who signed in. Use the district-app token to retrieve roster data. The user access token cannot list sections or students.
1. Authenticate the teacher
Support Clever Portal, Instant Login, and Log in with Clever entry points. Exchange the returned authorization code on your server; codes expire after one minute and can be exchanged once.
Make the callback handler idempotent. In native iOS apps, Safari and the app can both deliver the same code.
For the full OAuth flow, see OAuth Implementation.
2. Identify the signed-in teacher
Call /v3.0/me with the user access token. Use the returned Clever user ID and district ID to establish your application session.
If you need to account for every role a person holds, retrieve the user record with the district-app token and inspect roles.
3. Retrieve sections with the district-app token
Call GET /v3.1/users/{teacher_id} with the district-app token. Follow the user record’s sections relationship to retrieve the teacher’s sections.
Do not filter sections by the teacher’s primary school. A teacher can teach at multiple schools, and a section’s school can differ from the teacher’s primary school.
4. Retrieve students
Each section includes its student IDs. Retrieve a full student record only when your app needs fields beyond the IDs.
If a record returns 404 because it is not shared with your app, archive the local record when present or skip it when absent. Continue processing the rest of the roster.
5. Render the teacher experience
Show all retrieved sections and their students. Render an empty state when a teacher has no sections. Use Clever user IDs as your primary keys; do not use email or sis_id as primary identifiers.
Troubleshooting
| Symptom | Likely cause |
|---|---|
/me works but roster calls fail | A user access token was used where a district-app token is required. |
| Classes appear incomplete | Your app filtered sections by primary school. |
| Code exchange fails on iOS | The same authorization code was delivered twice. |
Related documentation
Updated about 2 hours ago

