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 totp parameter for Okta login #1110

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion hvac/api/auth_methods/okta.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def delete_group(self, name, mount_point=DEFAULT_MOUNT_POINT):
)

def login(
self, username, password, use_token=True, mount_point=DEFAULT_MOUNT_POINT
self, username, password, use_token=True, mount_point=DEFAULT_MOUNT_POINT, totp=None
):
"""Login with the username and password.

Expand All @@ -313,13 +313,17 @@ def login(
:type use_token: bool
:param mount_point: The "path" the method/backend was mounted on.
:type mount_point: str | unicode
:param totp: if provided, uses the value as the TOTP token for Okta.
:type totp: str | None
:return: The response of the login request.
:rtype: dict
"""
params = {
"username": username,
"password": password,
}
if (totp is not None):
params.update({"totp": totp})
voldemortensen marked this conversation as resolved.
Show resolved Hide resolved
api_path = utils.format_url(
"/v1/auth/{mount_point}/login/{username}",
mount_point=mount_point,
Expand Down