-
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.
- Loading branch information
Showing
3 changed files
with
4 additions
and
35 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 |
---|---|---|
@@ -1,33 +1,2 @@ | ||
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) | ||
# backwards compat import | ||
from ovos_backend_client.database import OAuthTokenDatabase, OAuthApplicationDatabase |
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