Exemplo n.º 1
0
from okta import UsersClient, UserGroupsClient
from dotenv import load_dotenv
import os

load_dotenv()
url = os.getenv('OKTA_ORG_URL')
token = os.getenv('OKTA_API_TOKEN')

usersClient = UsersClient(url, token)
groupsClient = UserGroupsClient(url, token)

user = usersClient.get_user('aaron')
groupId = '00g9raeyraaWXn1zF0h7'

groupsClient.add_user_to_group_by_id(groupId, user.id)
Exemplo n.º 2
0
from datetime import datetime
from okta import UsersClient
from okta import FactorsAdminClient
from okta import FactorsClient

# Get a users ID
usersClient = UsersClient("Your Site", "Your Token")

usersClient.get_user('Login Name').id
# Or this:
# 	usr = usersClient.get_user('Login Name').id
# 	usr.id

# Get a users factor, ID and time enrolled
userClients = FactorsClient("Your Site", "Your Token")

userClients = uclient.get_lifecycle_factors(user_id="User ID")
for client in userClients:
    print(client.factorType, client.id, client.created)

# Get the org's list of active factors
factorClient = FactorsAdminClient("Your Site", "Your Token")

clients = factorClient.get_org_factors()
for client in clients:
    if client.status != 'NOT_SETUP' and client.status != 'INACTIVE':
        print(client.factorType, client.id, client.status)

# Get all users enrollment date for a specific factor
site = 'Your Site'
skey = 'Your Key'