This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat/oauth * requirements.txt * missing oauth_id in url * missing api version in url * oauth
- Loading branch information
Showing
3 changed files
with
116 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from json_database import JsonStorageXDG | ||
|
||
|
||
class OAuthTokenDatabase(JsonStorageXDG): | ||
def __init__(self): | ||
super().__init__("ovos_oauth") | ||
|
||
def add_token(self, oauth_service, token_data): | ||
self[oauth_service] = token_data | ||
|
||
def total_tokens(self): | ||
return len(self) | ||
|
||
|
||
class OAuthApplicationDatabase(JsonStorageXDG): | ||
def __init__(self): | ||
super().__init__("ovos_oauth_apps") | ||
|
||
def add_application(self, oauth_service, | ||
client_id, client_secret, | ||
auth_endpoint, token_endpoint, refresh_endpoint, | ||
callback_endpoint, scope): | ||
self[oauth_service] = {"oauth_service": oauth_service, | ||
"client_id": client_id, | ||
"client_secret": client_secret, | ||
"auth_endpoint": auth_endpoint, | ||
"token_endpoint": token_endpoint, | ||
"refresh_endpoint": refresh_endpoint, | ||
"callback_endpoint": callback_endpoint, | ||
"scope": scope} | ||
|
||
def total_apps(self): | ||
return len(self) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ ovos-stt-plugin-server | |
geocoder | ||
timezonefinder | ||
requests_cache | ||
selene_api>=0.0.2 | ||
selene_api>=0.0.2 | ||
oauthlib~=3.0 |