-
Notifications
You must be signed in to change notification settings - Fork 0
Connect the backend to the GitHub Rock Android client #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
847cf5f
Add OAuth refresh configuration
SayanthRock 6c0e9a4
Document OAuth client secret
SayanthRock b6641fb
Complete backend OAuth response contract
SayanthRock be10762
Add complete backend Device Flow proxy
SayanthRock 58d9a97
Expose complete mobile backend contract
SayanthRock 5e1a63c
Test backend OAuth contract
SayanthRock aa40271
Use long OAuth expiry fixtures
SayanthRock 8cdb98f
Document complete Android backend contract
SayanthRock 3f010a5
Document mobile OAuth refresh endpoint
SayanthRock 397cf00
Test OAuth secret configuration
SayanthRock 5733bec
Verify companion Android integration branch
SayanthRock fa7a2cf
Run Android contract verification on backend runner
SayanthRock 12b9d87
Document enforced mobile compatibility contract
SayanthRock ac954df
Verify backend against Android main
SayanthRock File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,50 @@ | ||
| # API v1 | ||
|
|
||
| ## `GET /v1/health` | ||
|
|
||
| Reports the backend, PostgreSQL, Redis, and Meilisearch state. | ||
|
|
||
| ## `GET /v1/config` | ||
|
|
||
| Returns public app-version and feature-availability metadata. It never returns secrets. | ||
|
|
||
| GitHub Rock validates this response before using backend-assisted authentication. The Android client requires `apiVersion=v1`, rejects maintenance mode, checks `minSupportedAppVersion`, and verifies the required OAuth feature flag. When the backend is unavailable or incompatible, the app uses its direct-GitHub fallback when a public OAuth client ID is present. | ||
|
|
||
| Important mobile flags: | ||
|
|
||
| - `oauthDeviceProxy` — Device Flow start and poll are available. | ||
| - `oauthRefreshProxy` — expiring OAuth tokens can refresh through the backend. | ||
|
|
||
| ## `POST /v1/auth/device/start` | ||
| Starts GitHub Device Flow using the configured public OAuth client ID. | ||
|
|
||
| Starts GitHub Device Flow using the configured public OAuth client ID. The backend requests the same scopes as the Android app: | ||
|
|
||
| ```text | ||
| repo workflow read:user user:email read:org notifications user:follow | ||
| ``` | ||
|
|
||
| Returns `503 oauth_unavailable` when OAuth is not configured. | ||
|
|
||
| ## `POST /v1/auth/device/poll` | ||
| Body: `{ "device_code": "..." }`. Returns `pending`, `slow_down`, `authorized`, `expired`, `denied`, or `error`. | ||
|
|
||
| Body: | ||
|
|
||
| ```json | ||
| { "device_code": "..." } | ||
| ``` | ||
|
|
||
| Returns `pending`, `slow_down`, `authorized`, `expired`, `denied`, or `error`. Authorized responses preserve access-token expiry and refresh-token metadata returned by GitHub. | ||
|
|
||
| ## `POST /v1/auth/device/refresh` | ||
|
|
||
| Body: | ||
|
|
||
| ```json | ||
| { "refresh_token": "..." } | ||
| ``` | ||
|
|
||
| Exchanges an expiring refresh token through GitHub using the server-only OAuth client secret. Returns `503 oauth_refresh_unavailable` when the secret is not configured. Tokens are proxied to the requesting Android client and are not stored by this service. | ||
|
|
||
| ## `POST /v1/github/webhooks` | ||
|
|
||
| Requires valid `X-Hub-Signature-256`, `X-GitHub-Delivery`, and `X-GitHub-Event` headers. Payloads are capped at 1 MiB. Delivery IDs are persisted for replay protection; full payloads are not stored. |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.