Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add basic auth for Lever #17996

Merged
merged 19 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@
"refresh_token": "refresh_token",
"environment": "Sandbox",
"start_date": "2021-07-12T00:00:00Z"
},
{
"api_key": "c1adBeHUJKqyPM0X01tshKl4Pwh1LyPdmlorXjfmoDE0lVxZl",
alexchouraki marked this conversation as resolved.
Show resolved Hide resolved
"start_date": "2021-07-12T00:00:00Z"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@

from airbyte_cdk.sources import AbstractSource
from airbyte_cdk.sources.streams import Stream
from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator
from airbyte_cdk.sources.streams.http.auth import Oauth2Authenticator, BasicHttpAuthenticator

from .streams import Applications, Interviews, Notes, Offers, Opportunities, Referrals, Users


def _auth_from_config(config):
return Oauth2Authenticator(
client_id=config["credentials"]["client_id"],
client_secret=config["credentials"]["client_secret"],
refresh_token=config["credentials"]["refresh_token"],
token_refresh_endpoint=f"{SourceLeverHiring.URL_MAP_ACCORDING_ENVIRONMENT[config['environment']]['login']}oauth/token",
if config and config["credentials"] and 'api_key' in config["credentials"]:
alexchouraki marked this conversation as resolved.
Show resolved Hide resolved
return BasicHttpAuthenticator(username=config["credentials"]["api_key"], password = None, auth_method="Basic")
else:
return Oauth2Authenticator(
client_id=config["credentials"]["client_id"],
client_secret=config["credentials"]["client_secret"],
refresh_token=config["credentials"]["refresh_token"],
token_refresh_endpoint=f"{SourceLeverHiring.URL_MAP_ACCORDING_ENVIRONMENT[config['environment']]['login']}oauth/token",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@
"description": "Choose how to authenticate to Lever Hiring.",
"type": "object",
"oneOf": [
{
"type": "object",
"title": "Authenticate via Lever (Api Key)",
"required": ["api_key"],
"properties": {
"auth_type": {
"type": "string",
"const": "Api Key",
"enum": ["Api Key"],
"default": "Api Key",
"order": 0
},
"api_key": {
"title": "Api key",
"type": "string",
"description": "The Api Key of your Lever Hiring account.",
"airbyte_secret": true,
"order":1}
alexchouraki marked this conversation as resolved.
Show resolved Hide resolved
}
},
{
"type": "object",
"title": "Authenticate via Lever (OAuth)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

def setup_responses():
responses.add(
responses.POST, "https://sandbox-lever.auth0.com/oauth/token", json={"access_token": "fake_access_token", "expires_in": 3600}
responses.POST, "https://sandbox-lever.auth0.com/oauth/token", json={"access_token": "fake_access_token", "expires_in": 3600},
responses.GET, "https://api.lever.co/v1/opportunities", json={"api_key": "fake_api_key", "expires_in": 3600}
alexchouraki marked this conversation as resolved.
Show resolved Hide resolved
)


Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/lever-hiring.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ The Lever Hiring connector should not run into Lever Hiring API limitations unde

| Version | Date | Pull Request | Subject |
| :--- | :--- | :--- | :--- |
| 0.1.3 | 2022-10-14 | [17996](https://github.com/airbytehq/airbyte/pull/17996) | Add Basic Auth management |
| 0.1.2 | 2021-12-30 | [9214](https://github.com/airbytehq/airbyte/pull/9214) | Update title and descriptions |
| 0.1.1 | 2021-12-16 | [7677](https://github.com/airbytehq/airbyte/pull/7677) | OAuth Automated Authentication |
| 0.1.0 | 2021-09-22 | [6141](https://github.com/airbytehq/airbyte/pull/6141) | Add Lever Hiring Source Connector |
Expand Down