File tree 1 file changed +14
-0
lines changed
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,20 @@ impl Model for User {
137
137
}
138
138
139
139
/// Handles the `GET /authorize_url` route.
140
+ ///
141
+ /// This route will return an authorization URL for the GitHub OAuth flow including the crates.io
142
+ /// `client_id` and a randomly generated `state` secret.
143
+ ///
144
+ /// see https://developer.github.com/v3/oauth/#redirect-users-to-request-github-access
145
+ ///
146
+ /// ## Response Body Example
147
+ ///
148
+ /// ```json
149
+ /// {
150
+ /// "state": "b84a63c4ea3fcb4ac84",
151
+ /// "url": "https://github.com/login/oauth/authorize?client_id=...&state=...&scope=read%3Aorg"
152
+ /// }
153
+ /// ```
140
154
pub fn github_authorize ( req : & mut Request ) -> CargoResult < Response > {
141
155
// Generate a random 16 char ASCII string
142
156
let state: String = thread_rng ( ) . gen_ascii_chars ( ) . take ( 16 ) . collect ( ) ;
You can’t perform that action at this time.
0 commit comments