Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
douban-api-proxy
Project
Project
Details
Activity
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
captainwong
douban-api-proxy
Commits
d30b44ee
Commit
d30b44ee
authored
Jan 26, 2020
by
Michael Shavit
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor formatting changes per codacy review.
parent
cd9bb56d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
kobo.py
cps/kobo.py
+0
-1
kobo_auth.py
cps/kobo_auth.py
+3
-1
SyncToken.py
cps/services/SyncToken.py
+2
-2
No files found.
cps/kobo.py
View file @
d30b44ee
...
@@ -31,7 +31,6 @@ from flask import (
...
@@ -31,7 +31,6 @@ from flask import (
request
,
request
,
make_response
,
make_response
,
jsonify
,
jsonify
,
json
,
url_for
,
url_for
,
redirect
,
redirect
,
)
)
...
...
cps/kobo_auth.py
View file @
d30b44ee
...
@@ -26,7 +26,9 @@ When first booting a Kobo device the user must sign into a Kobo (or affiliate) a
...
@@ -26,7 +26,9 @@ When first booting a Kobo device the user must sign into a Kobo (or affiliate) a
Upon successful sign-in, the user is redirected to
Upon successful sign-in, the user is redirected to
https://auth.kobobooks.com/CrossDomainSignIn?id=<some id>
https://auth.kobobooks.com/CrossDomainSignIn?id=<some id>
which serves the following response:
which serves the following response:
<script type='text/javascript'>location.href='kobo://UserAuthenticated?userId=<redacted>&userKey<redacted>&email=<redacted>&returnUrl=https
%3
a
%2
f
%2
fwww.kobo.com';</script>.
<script type='text/javascript'>
location.href='kobo://UserAuthenticated?userId=<redacted>&userKey<redacted>&email=<redacted>&returnUrl=https
%3
a
%2
f
%2
fwww.kobo.com';
</script>
And triggers the insertion of a userKey into the device's User table.
And triggers the insertion of a userKey into the device's User table.
Together, the device's DeviceId and UserKey act as an *irrevocable* authentication
Together, the device's DeviceId and UserKey act as an *irrevocable* authentication
...
...
cps/services/SyncToken.py
View file @
d30b44ee
...
@@ -84,7 +84,7 @@ class SyncToken():
...
@@ -84,7 +84,7 @@ class SyncToken():
@
staticmethod
@
staticmethod
def
from_headers
(
headers
):
def
from_headers
(
headers
):
sync_token_header
=
headers
.
get
(
SyncToken
.
SYNC_TOKEN_HEADER
,
""
)
sync_token_header
=
headers
.
get
(
SyncToken
.
SYNC_TOKEN_HEADER
,
""
)
if
sync_token_header
==
""
:
if
not
sync_token_header
:
return
SyncToken
()
return
SyncToken
()
# On the first sync from a Kobo device, we may receive the SyncToken
# On the first sync from a Kobo device, we may receive the SyncToken
...
@@ -103,7 +103,7 @@ class SyncToken():
...
@@ -103,7 +103,7 @@ class SyncToken():
data_json
=
sync_token_json
[
"data"
]
data_json
=
sync_token_json
[
"data"
]
validate
(
sync_token_json
,
SyncToken
.
data_schema_v1
)
validate
(
sync_token_json
,
SyncToken
.
data_schema_v1
)
except
(
exceptions
.
ValidationError
,
ValueError
)
as
e
:
except
(
exceptions
.
ValidationError
,
ValueError
):
log
.
error
(
"Sync token contents do not follow the expected json schema."
)
log
.
error
(
"Sync token contents do not follow the expected json schema."
)
return
SyncToken
()
return
SyncToken
()
...
...
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