Skip to content

Commit

Permalink
Added manual authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
aheldes committed Jun 30, 2022
1 parent 6959022 commit 7495fef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions component_config/configSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"daily_load": {
"type": "boolean",
"title": "Daily load"
},
"manual_authentication": {
"type": "boolean",
"title": "Manual Authentication"
}
}
}
4 changes: 3 additions & 1 deletion src/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
KEY_CLIENT_SECRET = '#client_secret'
ENDPOINTS = 'endpoint'
DAILY = 'daily_load'
AUTHENTICATION = 'manual_authentication'

CODE_URL = "https://allegro.pl/auth/oauth/device"
TOKEN_URL = "https://allegro.pl/auth/oauth/token"
Expand Down Expand Up @@ -57,9 +58,10 @@ def run(self):
self.client_secret = params.get(KEY_CLIENT_SECRET)
self.endpoint = params.get(ENDPOINTS)
self.daily = params.get(DAILY)
self.authentication = params.get(AUTHENTICATION)

previous_state = self.get_state_file()
if previous_state.get('#refresh_token') is None:
if self.authentication:
code = self._get_code()
result = json.loads(code.text)
logging.info('Manual loggin needed for initial run.')
Expand Down

0 comments on commit 7495fef

Please sign in to comment.