Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
backend
Commits
b4cda492
Commit
b4cda492
authored
1 month ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
Better handling of OAuth servers response
parent
573ca987
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
api/src/api/authentication.py
+15
-4
15 additions, 4 deletions
api/src/api/authentication.py
with
15 additions
and
4 deletions
api/src/api/authentication.py
+
15
−
4
View file @
b4cda492
...
...
@@ -396,10 +396,21 @@ else:
raise
ValueError
(
"
Session auth scope set to something different than rwth or moodle
"
)
try
:
token_response
=
__make_oauth_request
(
"
token
"
,
code
=
api_session
.
running_oauth_code
,
grant_type
=
"
device
"
)
if
token_response
.
get
(
"
status
"
)
!=
"
ok
"
:
# TODO debug statement
print
(
f
"
Got non-
'
ok
'
status for OAuth:
{
token_response
}
"
)
match
token_response
.
get
(
"
status
"
):
case
"
error: authorization pending.
"
:
return
case
"
error: device code invalid.
"
:
# We get this when the user declines the authorization
api_session
.
running_oauth_code
=
None
api_session
.
running_oauth_scope
=
None
return
case
"
error: slow down.
"
:
ERROR_NOTIFIER
.
notify
(
"
Warning: Got
'
error: slow down.
'
from RWTH OAuth server
"
)
return
case
"
ok
"
:
pass
case
_
:
raise
Exception
(
f
"
Got unknown status from RWTH OAuth server:
{
token_response
.
get
(
"
status
"
)
}
. Full response:
{
token_response
}
"
)
api_session
.
running_oauth_code
=
None
api_session
.
running_oauth_scope
=
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment