File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -150,6 +150,33 @@ pub fn github_authorize(req: &mut Request) -> CargoResult<Response> {
150
150
}
151
151
152
152
/// 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
+ /// see https://developer.github.com/v3/oauth/#github-redirects-back-to-your-site
160
+ ///
161
+ /// ## Query Parameters
162
+ ///
163
+ /// - `code` – temporary code received from the GitHub API **(Required)**
164
+ /// - `state` – state parameter received from the GitHub API **(Required)**
165
+ ///
166
+ /// ## Response Body Example
167
+ ///
168
+ /// ```json
169
+ /// {
170
+ /// "api_token": "b84a63c4ea3fcb4ac84",
171
+ /// "user": {
172
+
173
+ /// "name": "Foo Bar",
174
+ /// "login": "foobar",
175
+ /// "avatar": "https://avatars.githubusercontent.com/u/1234",
176
+ /// "url": null
177
+ /// }
178
+ /// }
179
+ /// ```
153
180
pub fn github_access_token ( req : & mut Request ) -> CargoResult < Response > {
154
181
// Parse the url query
155
182
let mut query = req. query ( ) ;
You can’t perform that action at this time.
0 commit comments