flypenguin / okta-cli Goto Github PK
View Code? Open in Web Editor NEWA command line interface to Okta
License: MIT License
A command line interface to Okta
License: MIT License
First, thank you so much for creating and maintaining this utility.
I upgraded from a working pip install of 17.3.2
to a pip install of 18.0.0
using pip install --upgrade okta-cli
.
After upgrading, running okta-cli
returns the following Traceback:
Traceback (most recent call last):
File "/usr/local/bin/okta-cli", line 5, in <module>
from oktacli import cli_main
File "/usr/local/lib/python3.10/site-packages/oktacli/__init__.py", line 1, in <module>
from .cli import cli_main
File "/usr/local/lib/python3.10/site-packages/oktacli/cli.py", line 17, in <module>
from .dotted.collection import DottedDict, DottedCollection
ModuleNotFoundError: No module named 'oktacli.dotted'
Looking at the site-package path, I saw that the dotted folder present in the repository is missing:
ls -lah /usr/local/lib/python3.10/site-packages/oktacli
-rw-r--r-- 1 daniel.huckmann admin 26B Jan 31 15:58 __init__.py
-rw-r--r-- 1 daniel.huckmann admin 70B Jan 31 15:58 __main__.py
drwxr-xr-x 9 daniel.huckmann admin 288B Jan 31 16:08 __pycache__
-rw-r--r-- 1 daniel.huckmann admin 2.9K Jan 31 15:58 api.py
-rw-r--r-- 1 daniel.huckmann admin 65K Jan 31 16:08 cli.py
-rw-r--r-- 1 daniel.huckmann admin 129B Jan 31 15:58 exceptions.py
-rw-r--r-- 1 daniel.huckmann admin 7.5K Jan 31 15:58 okta.py
-rw-r--r-- 1 daniel.huckmann admin 610B Jan 31 15:58 pwgen.py
-rw-r--r-- 1 daniel.huckmann admin 8.2M Jan 31 15:58 wordlist.sqlite
Copying the dotted
folder from the repository into /usr/local/lib/python3.10/site-packages/oktacli
corrected the issue.
I tried to upgrade my Python version to 3.10.5 and get the following error when running okta-cli list
.
class DottedList(DottedCollection, collections.MutableSequence): AttributeError: module 'collections' has no attribute 'MutableSequence'
Does anyone know if Okta-cli can support Python version 3.10.x? Thanks.
When running the command :
okta-cli users groups -h
The result shows: List all users in a group where it should be saying that it lists all groups belonging to that user
I'm trying to use okta-cli to set the value of an array-based attribute in Okta. The code currently assumes string only values for all cli arguments. However, I've been looking into how setting array based value could be implemented:
I managed to modify cli.py to somewhat detect an array if an attribute value starts/end with [
and ]
. It is not pretty, but it somewhat works for what needed:
@@ -860,6 +860,9 @@ def apps_getuser(app, user, user_lookup_field, **kwargs):
def apps_adduser(app, user, user_lookup_field, set_fields, **kwargs):
"""Add a user to an application"""
appuser = {k: v for k, v in map(lambda x: x.split("=", 1), set_fields)}
+ for k,v in appuser.items():
+ if v.startswith("[") and v.endswith("]"):
+ appuser[k] = v.lstrip("[").rstrip("]").split(",")
app = _okta_get("apps", app,
selector=_selector_field_find("label", app))
user = _okta_get("users", user,
However, [
and ]
characters need to be escaped at the shell level
% okta-cli apps adduser -a 0oado6m4123457Ao0357 -u [email protected] \
-s profile.stringAttribute="String value" \
-s profile.arrayAttribute=\["A","B"\]
However, it would prevent someone from adding an actual string value that starts with a [
into an Okta attribute.
What would be the preferred way to handle a cli parameter value that is an array?
Was sure the best way to make a feature request here. What I really need is a ways to auth to Okta to create and admin API with a limited duration from the command line. In this case you could also then have it interact with the config from that id. Or simply print or set that short term key to an env var I could use elsewhere.
When I run the following:
okta-cli users add --set "[email protected]" --set "[email protected]" --set "firstName=First" --set "lastName=Last"
I get the following error:
ERROR: {"errorCode": "E0000003", "errorSummary": "The request body was not well-formed.", "errorLink": "E0000003", "errorId": "oaewUnkGrYhRWWZKWIxxxx", "errorCauses": []}
This fixes it:
in okta.py
if I add the following line: body_object = { 'profile': body_object }
then add_user succeeds.
like so
def add_user(self, query_params, body_object):
body_object = { 'profile': body_object }
body = json.dumps(body_object).encode("utf-8")
then I get a success from the API:
"status": "PROVISIONED",
Would you like me to create a pull request?
The README is missing a few key pieces of information to help me to figure out how the application works. For example, the sample query 'email eq "[email protected]"'
doesn't work for me, I think it should be 'profile.email eq "[email protected]"'
as per the Okta docs.
I also would like to make it clearer where the config file is stored.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.