Skip to content

Commit

Permalink
update & debug
Browse files Browse the repository at this point in the history
Signed-off-by: viste <[email protected]>
  • Loading branch information
Viste committed Aug 20, 2024
1 parent 2646c9b commit 10de3ad
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setup_routes(app, oauth):
name='vk',
client_id=Config.VK_CLIENT_ID,
client_secret=Config.VK_CLIENT_SECRET,
authorize_url='https://id.vk.com/oauth2/auth',
authorize_url='https://id.vk.com/authorize',
access_token_url='https://id.vk.com/oauth2/token',
client_kwargs={
'scope': 'email',
Expand Down Expand Up @@ -163,6 +163,11 @@ def authorize_vk():

print(f'Response from VK: {resp.json()}')

if resp.status_code != 200:
print(f'VK API error: {resp.status_code} - {resp.text}')
flash(f'VK API error: {resp.status_code}', 'danger')
return redirect(url_for('login'))

profile = resp.json().get('response', [])[0]
if not profile:
flash('Failed to retrieve user profile from VK', 'danger')
Expand Down

0 comments on commit 10de3ad

Please sign in to comment.