Skip to content

Commit 68cb068

Browse files
committed
user: Extend github_access_token documentation
1 parent df633f9 commit 68cb068

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/user/mod.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,31 @@ pub fn github_authorize(req: &mut Request) -> CargoResult<Response> {
150150
}
151151

152152
/// Handles the `GET /authorize` route.
153+
///
154+
/// This route is called from the GitHub API OAuth flow after the user accepted or rejected
155+
/// the data access permissions. It will check the `state` parameter and then call the GitHub API
156+
/// to exchange the temporary `code` for an API token. The API token is returned together with
157+
/// the corresponding user information.
158+
///
159+
/// ## Query Parameters
160+
///
161+
/// - `code` – temporary code received from the GitHub API **(Required)**
162+
/// - `state` – state parameter received from the GitHub API **(Required)**
163+
///
164+
/// ## Response Body Example
165+
///
166+
/// ```json
167+
/// {
168+
/// "api_token": "b84a63c4ea3fcb4ac84",
169+
/// "user": {
170+
/// "email": "[email protected]",
171+
/// "name": "Foo Bar",
172+
/// "login": "foobar",
173+
/// "avatar": "https://avatars.githubusercontent.com/u/1234",
174+
/// "url": null
175+
/// }
176+
/// }
177+
/// ```
153178
pub fn github_access_token(req: &mut Request) -> CargoResult<Response> {
154179
// Parse the url query
155180
let mut query = req.query();

0 commit comments

Comments
 (0)