Skip to content

Commit 729fa28

Browse files
authored
github_token_validity endpoint bugfix (#637)
1 parent f9c942b commit 729fa28

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mod_auth/controllers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def before_app_request() -> None:
5454

5555
def login_required(f: Callable) -> Callable:
5656
"""Decorate the function to redirect to the login page if a user is not logged in."""
57+
5758
@wraps(f)
5859
def decorated_function(*args, **kwargs):
5960
if g.user is None:
@@ -134,10 +135,10 @@ def github_token_validity(token: str):
134135
from run import config
135136
github_client_id = config.get('GITHUB_CLIENT_ID', '')
136137
github_client_secret = config.get('GITHUB_CLIENT_SECRET', '')
137-
url = f'https://api.github.com/applications/{github_client_id}/tokens/{token}'
138+
url = f'https://api.github.com/applications/{github_client_id}/token'
138139
session = requests.Session()
139140
session.auth = (github_client_id, github_client_secret)
140-
response = session.get(url)
141+
response = session.post(url, json={"access_token": token})
141142

142143
return response.status_code == 200
143144

0 commit comments

Comments
 (0)