Skip to content

Allow unauthenticated API calls#53

Open
MathijsR94 wants to merge 3 commits intomainfrom
feature/unauthenticated-calls
Open

Allow unauthenticated API calls#53
MathijsR94 wants to merge 3 commits intomainfrom
feature/unauthenticated-calls

Conversation

@MathijsR94
Copy link
Copy Markdown
Collaborator

Summary

  • Remove the authentication gate so users can add usernames and view contribution heatmaps without a GitHub PAT or OAuth sign-in
  • Add a public REST API fallback (/users/:username + /users/:username/events/public) that builds contribution calendars and stats from public event data when no token is configured
  • Show a "Public activity only — sign in for full data" prompt on each card when using the unauthenticated path, linking to the sign-in flow
  • Unlock all settings drawer sections (users, date range, display) for unauthenticated users; only org import remains gated behind auth
  • Fixes Public data by default, PAT optional #36

Details

  • New files: src/lib/githubRest.ts (REST API client), src/lib/fetchContributionsPublic.ts (builds ContributionsCollection from public events)
  • Renamed github.tsgithubGraphQL.ts and fetchContributions.tsfetchContributionsGraphQL.ts for clarity
  • useContributions now branches into fetchAllAuthenticated vs fetchAllUnauthenticated paths based on whether a PAT exists
  • Added needsAuth flag to UserResult type to signal partial data to the UI
  • FetchValidationError no longer includes "missing-pat"
  • SettingsDrawer refactored: extracted inline handlers, removed the "Sign in to configure" gate that hid all controls

Limitations

  • Public events API only returns the last 90 days / 300 events, so historical data and long date ranges will be incomplete without auth
  • Previous-period comparison is not available in unauthenticated mode
  • Org filtering still requires authentication (GraphQL API)

@MathijsR94 MathijsR94 requested a review from brdv March 29, 2026 12:28
@MathijsR94 MathijsR94 added the access & auth Authentication and access control label Mar 29, 2026
@brdv
Copy link
Copy Markdown
Collaborator

brdv commented Mar 29, 2026

Somehow, editing the org is disabled which can be funky if i received a state url;

image

@MathijsR94 MathijsR94 force-pushed the feature/unauthenticated-calls branch from 14a1364 to 7fb127d Compare April 6, 2026 12:39
@MathijsR94
Copy link
Copy Markdown
Collaborator Author

Somehow, editing the org is disabled which can be funky if i received a state url;

image

I have added a read-only state when a user receives a state with an organisation in it. It was disabled at first

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

access & auth Authentication and access control

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public data by default, PAT optional

2 participants