Repository navigation
Conversation
Servers that register an intervals.icu OAuth app and set INTERVALS_CLIENT_ID and INTERVALS_CLIENT_SECRET offer a "Connect with intervals.icu" button that asks only to read activities. Pasting an API key still works everywhere, and is all there is on servers without an app. Existing connections keep working (auth_method defaults to api_key). The sign-in uses PKCE and a signed, short-lived cookie for the state. Disconnecting revokes the token. Settings refreshes while a sync runs, so the first sync after the redirect shows up, and the PWA no longer caches navigations under /api. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The OAuth migration is regenerated as 0009_intervals_oauth, after main's 0008_club_logo. Demo mode turns OAuth off (everyone shares one login), and its limits also block the GET that starts the intervals.icu sign-in. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Members can connect intervals.icu with a Connect with intervals.icu button instead of pasting an API key, on servers that have registered an intervals.icu OAuth app. Pasting a key still works everywhere, and it's the only option on servers without an app.
Setting it up on a server
<ORIGIN>/api/integrations/intervals/oauth/callback.INTERVALS_CLIENT_IDandINTERVALS_CLIENT_SECRETand restart.Each server needs its own app, because intervals.icu ties an app to its redirect URIs. This is in the README (new Watch sync section) and
.env.example.How it works
integration.auth_method(api_keyoroauth, migration0009_intervals_oauth, defaults toapi_key) says how the member connected. The key or token is stored encrypted incredentialseither way, and the client sendsBasicorBearerto match./api/integrations/intervals/oauth/start. That route keeps the state, PKCE verifier, member and start date in a signed, HttpOnly cookie for 10 minutes, then redirects to intervals.icu asking forACTIVITY:READonly./settings?intervals=connected|denied|expired|taken|failed, and Settings shows a message for each.DELETE /api/v1/disconnect-app). So does losing the "already connected to someone else" race./api, so the sign-in redirects always reach the server.Testing
Not tested against the real intervals.icu, because that needs a registered and approved app. The requests follow the OAuth docs.
Demo mode: OAuth is off on the demo, where everyone shares one login, and the demo's limits also block the GET that starts the sign-in.
🤖 Generated with Claude Code