Skip to main content

Okta login made easy from the command line without API token

Project description

Okta Login Wrapper

Provide an easy way for your scripts to access ressources behind an Okta SSO solution, without the need for an API token.


  • Python 3
  • Python modules
    • Requests
    • lxml
  • An Okta account


Simply make sure you have the required python modules installed.

pip install -r requirements.txt

Once done, place in the same folder as your own script.

Getting Started

~WARNING~ Currently the script only works if you have "push" enabled as MFA.

The main goal of this script is to help you login to an application using SSO with Okta, without requiring any API token.

As part of another scripts, it allows you to have an okta_session object from where you can connect to all application assigned to you in Okta.

from oktaloginwrapper import OktaLoginWrapper as OLW

#  Create a session with your okta instance name as well as your credentials.
#  If the credentials are correct, you'll be asked for MFA. (Currently only work with push notification)

my_session = OLW.OktaSession(okta_instance) #Where okta_instance is https://<okta_instance>
my_session.okta_auth(okta_username, okta_password)

Then, depending on the type of script you are writing, here's what you can do.

As a non-interactive script:

#  Use connect_to() with the 'Embed Link' of an app in Okta as parameter. 
#  You can find that url in Okta admin portal on the general tab of an app.
#  Or by using the provided method app_list()

my_app = my_session.connect_to(app_url)

As an interactive script:

#  You can prompt the user to type the name of an app he wants to log into.
#  A list is returned with with corresponding apps and the user has to select which one to login to.
#  If connection is successful, it returns a requests.models.response of the homepage of the app.
#  From there, you can navigate the app using your object my_session.

my_app = my_session.connect_from_appslist()

Close the session once you're done.


It can also be executed but this is mainly a proof of concept as it just print the raw content. I will probably remove that part at some point in the future.

Built With

  • Requests - Python HTTP Requests for Humans
  • lxml - The lxml XML toolkit for Python


This project is licensed under the MIT License - see the file for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for oktaloginwrapper, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size oktaloginwrapper-0.1.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View
Filename, size oktaloginwrapper-0.1-py3-none-any.whl (5.0 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page