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

Issue with authenticate() method #41

Closed
ksshetty opened this issue Mar 28, 2017 · 2 comments
Closed

Issue with authenticate() method #41

ksshetty opened this issue Mar 28, 2017 · 2 comments

Comments

@ksshetty
Copy link

ksshetty commented Mar 28, 2017

Following is my code snippet:

def authenticate(self, username, password):
        self.logger.debug("Attempting to authenticate user: %s" % username)
        auth_client = AuthClient(base_url=self.base_url, api_token=self.api_key)
        auth_result = auth_client.authenticate(username=username, password=password)
        self.logger.debug("Authentication result: username: %s status: %s" % (username, auth_result.status))
        return auth_result.status

I get the following error while attempting to authenticate a user that has been successfully created on the Okta server.

>>> okta_backend.authenticate(username, password)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/Users/shetty/work/authentication/models.py", line 136, in authenticate
    return auth_engine.authenticate(username, password)
  File "/Users/shetty/work/authentication/auth_okta.py", line 35, in authenticate
    auth_result = auth_client.authenticate(username=username, password=password)
  File "/Users/shetty/pyenv/src/okta/okta/AuthClient.py", line 41, in authenticate
    response = ApiClient.post_path(self, '/', request, params=params)
  File "/Users/shetty/pyenv/src/okta/okta/framework/ApiClient.py", line 88, in post_path
    return self.post(self.base_url + url_path, data, params)
  File "/Users/shetty/pyenv/src/okta/okta/framework/ApiClient.py", line 67, in post
    if self.__check_response(resp, attempts):
  File "/Users/shetty/pyenv/src/okta/okta/framework/ApiClient.py", line 102, in __check_response
    raise OktaError(json.loads(resp.text))
OktaError: Authentication failed
@ksshetty
Copy link
Author

I have verified that the credentials being passed in are correct.

@ksshetty
Copy link
Author

Sorry for jumping the gun. The user on the Okta server was in 'Reset Password' and hence the error. This method works when the user is in the 'active' state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant