Get the Github authorization token.
(code, **kwargs)
| 244 | |
| 245 | |
| 246 | def get_github_user_token(code, **kwargs): |
| 247 | """Get the Github authorization token.""" |
| 248 | _params = {'code': code, 'client_id': settings.GITHUB_CLIENT_ID, 'client_secret': settings.GITHUB_CLIENT_SECRET} |
| 249 | # Add additional parameters to the request paramaters. |
| 250 | _params.update(kwargs) |
| 251 | response = requests.get(settings.GITHUB_TOKEN_URL, headers=JSON_HEADER, params=_params) |
| 252 | response = response.json() |
| 253 | scope = response.get('scope', None) |
| 254 | if scope: |
| 255 | access_token = response.get('access_token', None) |
| 256 | return access_token |
| 257 | return None |
| 258 | |
| 259 | |
| 260 | def get_github_user_data(oauth_token): |