Skip to main content

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.

Prerequisite

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

Installing

Simply make sure you have the required python modules installed.

pip install -r requirements.txt

Once done, place OktaLoginWrapper.py 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>.okta.com
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.

my_session.okta_session.close()

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

License

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

Release files for oktaloginwrapper 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for oktaloginwrapper 0.1
File Size Uploaded
oktaloginwrapper-0.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oktaloginwrapper 0.1
File Interpreter ABI Platform
oktaloginwrapper-0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / oktaloginwrapper-0.1.tar.gz

Download URL oktaloginwrapper-0.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1ce0a53ec3157f486a47e241e274ff97b49116c71fa3e02f5606bdc560bd467c
BLAKE2b-256 checksum
How to use checksums
b75c6ac2956fe3e3d8581d2edf54aa268e1615ab784df34122375be12ce95c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / oktaloginwrapper-0.1-py3-none-any.whl

Download URL oktaloginwrapper-0.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eeda08e051a408522925e3f5b1da8bfd9dfe33bfdd9afe51cadbfba63e6894a0
BLAKE2b-256 checksum
How to use checksums
c47429686af889dbb436222edf4c3a93a49ede90368bfb1312ffe6069a8ff23f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

0.2.2

1 release file

0.2.1

3 release files

0.2

1 release file

This release

0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page