Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
weboob
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
180
Issues
180
List
Boards
Labels
Milestones
Merge Requests
53
Merge Requests
53
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
weboob
weboob
Commits
910d3d26
Commit
910d3d26
authored
Dec 30, 2018
by
Romain Bignon
Committed by
Romain Bignon
Jan 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OAuth2Mixin: redirect_uri has to be supplied
parent
13000553
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
10 deletions
+17
-10
weboob/browser/browsers.py
weboob/browser/browsers.py
+17
-10
No files found.
weboob/browser/browsers.py
View file @
910d3d26
...
...
@@ -49,7 +49,7 @@ except ImportError:
from
weboob.exceptions
import
BrowserHTTPSDowngrade
,
ModuleInstallError
,
BrowserRedirect
,
BrowserIncorrectPassword
from
weboob.tools.log
import
getLogger
from
weboob.tools.compat
import
basestring
,
unicode
,
urlparse
,
urljoin
,
quote_plus
,
parse_qsl
from
weboob.tools.compat
import
basestring
,
unicode
,
urlparse
,
urljoin
,
urlencode
,
parse_qsl
from
weboob.tools.json
import
json
from
.cookies
import
WeboobCookieJar
...
...
@@ -996,11 +996,18 @@ class OAuth2Mixin(StatesMixin):
else
:
self
.
request_authorization
()
def
build_authorization_parameters
(
self
):
return
{
'redirect_uri'
:
self
.
redirect_uri
,
'scope'
:
self
.
SCOPE
,
'client_id'
:
self
.
client_id
,
'response_type'
:
'code'
,
}
def
build_authorization_uri
(
self
):
return
self
.
AUTHORIZATION_URI
%
{
'redirect_uri'
:
quote_plus
(
self
.
redirect_uri
),
'scope'
:
quote_plus
(
self
.
SCOPE
),
'client_id'
:
quote_plus
(
self
.
client_id
)
}
p
=
urlparse
(
self
.
AUTHORIZATION_URI
)
q
=
dict
(
parse_qsl
(
p
.
query
))
q
.
update
(
self
.
build_authorization_parameters
()
)
return
p
.
_replace
(
query
=
urlencode
(
q
))
.
geturl
()
def
request_authorization
(
self
):
raise
BrowserRedirect
(
self
.
build_authorization_uri
())
...
...
@@ -1062,11 +1069,11 @@ class OAuth2PKCEMixin(OAuth2Mixin):
digest
=
sha256
(
verifier
)
.
hexdigest
()
return
base64
.
urlsafe_b64encode
(
digest
)
def
build_authorization_
uri
(
self
):
return
self
.
AUTHORIZATION_URI
%
{
'redirect_uri'
:
(
self
.
redirect_uri
)
,
'pkce_challenge'
:
quote_plus
(
self
.
pkce_challenge
)
,
'client_id'
:
quote_plus
(
self
.
client_id
)
}
def
build_authorization_
parameters
(
self
):
return
{
'redirect_uri'
:
self
.
redirect_uri
,
'code_challenge'
:
self
.
pkce_challenge
,
'client_id'
:
self
.
client_id
}
def
build_access_token_parameters
(
self
,
values
):
return
{
'code'
:
values
[
'code'
],
...
...
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