-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎉 Source Okta: added parameter 'start_date' (#15050)
* Added parameter 'start_date' in Okta source added: parameter 'start_date' to source Okta changed: unit tests * changes: fix in the case of ISSUE: #14196 * Okta documentation in new format * changes: fix to use super() instead of instance of stream parent * changes: additional changes into OKTA documentaton * changes: switch release to beta * changed: set dockerImageTag -> 0.1.11 * changed: source_specs * ... * ... * Rollback releaseStage * Refactored start date logic * Deleted microseconds from state * Add start date to all streams * Updated to linter * Fixed unit tests * Updated unit tests * auto-bump connector version [ci skip] Co-authored-by: Serhii <serglazebny@gmail.com> Co-authored-by: Octavia Squidington III <octavia-squidington-iii@users.noreply.github.com>
- Loading branch information
1 parent
8282a45
commit 8d9a3aa
Showing
13 changed files
with
431 additions
and
269 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
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
30 changes: 30 additions & 0 deletions
30
airbyte-integrations/connectors/source-okta/source_okta/authenticator.py
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,30 @@ | ||
# | ||
# Copyright (c) 2022 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from typing import Any, Mapping, Tuple | ||
|
||
import requests | ||
from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator | ||
|
||
|
||
class OktaOauth2Authenticator(Oauth2Authenticator): | ||
def get_refresh_request_body(self) -> Mapping[str, Any]: | ||
return { | ||
"grant_type": "refresh_token", | ||
"refresh_token": self.refresh_token, | ||
} | ||
|
||
def refresh_access_token(self) -> Tuple[str, int]: | ||
try: | ||
response = requests.request( | ||
method="POST", | ||
url=self.token_refresh_endpoint, | ||
data=self.get_refresh_request_body(), | ||
auth=(self.client_id, self.client_secret), | ||
) | ||
response.raise_for_status() | ||
response_json = response.json() | ||
return response_json["access_token"], response_json["expires_in"] | ||
except Exception as e: | ||
raise Exception(f"Error while refreshing access token: {e}") from e |
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
Oops, something went wrong.