Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
598336b2
Commit
598336b2
authored
Jun 15, 2023
by
jyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix notion auth failed
parent
fefa3482
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
data_source_oauth.py
api/controllers/console/auth/data_source_oauth.py
+15
-10
No files found.
api/controllers/console/auth/data_source_oauth.py
View file @
598336b2
...
...
@@ -51,16 +51,21 @@ class OAuthDataSourceCallback(Resource):
oauth_provider
=
OAUTH_DATASOURCE_PROVIDERS
.
get
(
provider
)
if
not
oauth_provider
:
return
{
'error'
:
'Invalid provider'
},
400
code
=
request
.
args
.
get
(
'code'
)
try
:
oauth_provider
.
get_access_token
(
code
)
except
requests
.
exceptions
.
HTTPError
as
e
:
logging
.
exception
(
f
"An error occurred during the OAuthCallback process with {provider}: {e.response.text}"
)
return
{
'error'
:
'OAuth data source process failed'
},
400
return
redirect
(
f
'{current_app.config.get("CONSOLE_URL")}?oauth_data_source=success'
)
if
'code'
in
request
.
args
:
code
=
request
.
args
.
get
(
'code'
)
try
:
oauth_provider
.
get_access_token
(
code
)
except
requests
.
exceptions
.
HTTPError
as
e
:
logging
.
exception
(
f
"An error occurred during the OAuthCallback process with {provider}: {e.response.text}"
)
return
{
'error'
:
'OAuth data source process failed'
},
400
return
redirect
(
f
'{current_app.config.get("CONSOLE_URL")}?oauth_data_source=success'
)
elif
'error'
in
request
.
args
:
error
=
request
.
args
.
get
(
'error'
)
return
redirect
(
f
'{current_app.config.get("CONSOLE_URL")}?oauth_data_source={error}'
)
else
:
return
redirect
(
f
'{current_app.config.get("CONSOLE_URL")}?oauth_data_source=access_denied'
)
class
OAuthDataSourceSync
(
Resource
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment