onelogin

OpenAPI Specification for OneLogin

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 3.1.0
  • Package version: 3.1.0
  • Build package: org.openapitools.codegen.languages.PythonPriorClientCodegen For more information, please visit https://support.onelogin.com

Requirements.

Python >=3.6

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import onelogin

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import onelogin

Getting Started

Please follow the installation procedure and then run the following:

import time
import onelogin
from pprint import pprint
from onelogin.api import default_api
from onelogin.model.activate_factor_request import ActivateFactorRequest
from onelogin.model.add_access_token_claim_request import AddAccessTokenClaimRequest
from onelogin.model.add_client_app_request import AddClientAppRequest
from onelogin.model.add_role_users200_response_inner import AddRoleUsers200ResponseInner
from onelogin.model.add_scope_request import AddScopeRequest
from onelogin.model.auth_method import AuthMethod
from onelogin.model.client_app import ClientApp
from onelogin.model.connector import Connector
from onelogin.model.create_authorization_server_request import CreateAuthorizationServerRequest
from onelogin.model.create_environment_variable_request import CreateEnvironmentVariableRequest
from onelogin.model.create_roles201_response_inner import CreateRoles201ResponseInner
from onelogin.model.create_session_login_token200_response import CreateSessionLoginToken200Response
from onelogin.model.create_session_login_token400_response import CreateSessionLoginToken400Response
from onelogin.model.create_session_login_token_request import CreateSessionLoginTokenRequest
from onelogin.model.device import Device
from onelogin.model.dry_run_mapping200_response_inner import DryRunMapping200ResponseInner
from onelogin.model.enroll_factor_request import EnrollFactorRequest
from onelogin.model.envvar import Envvar
from onelogin.model.error_status import ErrorStatus
from onelogin.model.factor import Factor
from onelogin.model.generate_mfa_token200_response import GenerateMfaToken200Response
from onelogin.model.generate_mfa_token422_response import GenerateMfaToken422Response
from onelogin.model.generate_mfa_token_request import GenerateMfaTokenRequest
from onelogin.model.generate_saml_assertion200_response import GenerateSamlAssertion200Response
from onelogin.model.generate_saml_assertion_request import GenerateSamlAssertionRequest
from onelogin.model.generate_token200_response import GenerateToken200Response
from onelogin.model.generate_token400_response import GenerateToken400Response
from onelogin.model.get_authorization_server200_response import GetAuthorizationServer200Response
from onelogin.model.get_available_factors200_response_inner import GetAvailableFactors200ResponseInner
from onelogin.model.get_client_apps200_response_inner import GetClientApps200ResponseInner
from onelogin.model.get_event_by_id200_response import GetEventById200Response
from onelogin.model.get_event_types200_response import GetEventTypes200Response
from onelogin.model.get_events200_response import GetEvents200Response
from onelogin.model.get_group_by_id200_response import GetGroupById200Response
from onelogin.model.get_groups200_response import GetGroups200Response
from onelogin.model.get_rate_limit200_response import GetRateLimit200Response
from onelogin.model.get_risk_score200_response import GetRiskScore200Response
from onelogin.model.get_risk_score400_response import GetRiskScore400Response
from onelogin.model.get_risk_score_request import GetRiskScoreRequest
from onelogin.model.get_score_insights200_response import GetScoreInsights200Response
from onelogin.model.get_user_apps200_response_inner import GetUserApps200ResponseInner
from onelogin.model.hook import Hook
from onelogin.model.hook_status import HookStatus
from onelogin.model.id import Id
from onelogin.model.list_access_token_claims200_response_inner import ListAccessTokenClaims200ResponseInner
from onelogin.model.list_actions200_response_inner import ListActions200ResponseInner
from onelogin.model.list_app_users200_response_inner import ListAppUsers200ResponseInner
from onelogin.model.list_authorization_servers200_response_inner import ListAuthorizationServers200ResponseInner
from onelogin.model.list_condition_operators200_response_inner import ListConditionOperators200ResponseInner
from onelogin.model.list_condition_values200_response_inner import ListConditionValues200ResponseInner
from onelogin.model.list_conditions200_response_inner import ListConditions200ResponseInner
from onelogin.model.list_mapping_condition_operators200_response_inner import ListMappingConditionOperators200ResponseInner
from onelogin.model.list_mapping_conditions200_response_inner import ListMappingConditions200ResponseInner
from onelogin.model.list_scopes200_response_inner import ListScopes200ResponseInner
from onelogin.model.log import Log
from onelogin.model.mapping import Mapping
from onelogin.model.mapping_id_list import MappingIdList
from onelogin.model.registration import Registration
from onelogin.model.remove_role_users_request import RemoveRoleUsersRequest
from onelogin.model.revoke_token_request import RevokeTokenRequest
from onelogin.model.risk_rule import RiskRule
from onelogin.model.role import Role
from onelogin.model.rule import Rule
from onelogin.model.rule_id import RuleId
from onelogin.model.rule_id_list import RuleIdList
from onelogin.model.schema import Schema
from onelogin.model.schema1 import Schema1
from onelogin.model.set_role_apps200_response_inner import SetRoleApps200ResponseInner
from onelogin.model.status import Status
from onelogin.model.track_event_request import TrackEventRequest
from onelogin.model.update_authorization_server400_response import UpdateAuthorizationServer400Response
from onelogin.model.update_client_app_request import UpdateClientAppRequest
from onelogin.model.update_environment_variable_request import UpdateEnvironmentVariableRequest
from onelogin.model.update_role200_response import UpdateRole200Response
from onelogin.model.user import User
from onelogin.model.v1_verify_factor200_response import V1VerifyFactor200Response
from onelogin.model.v1_verify_factor_request import V1VerifyFactorRequest
from onelogin.model.verify_enrollment_request import VerifyEnrollmentRequest
from onelogin.model.verify_factor_request import VerifyFactorRequest
from onelogin.model.verify_factor_saml200_response import VerifyFactorSaml200Response
from onelogin.model.verify_factor_saml_request import VerifyFactorSamlRequest
from onelogin.model.verify_factor_voice200_response_inner import VerifyFactorVoice200ResponseInner
# Defining the host is optional and defaults to https://api.us.onelogin.com
# See configuration.py for a list of all supported configuration parameters.
configuration = onelogin.Configuration(
    host = "https://api.us.onelogin.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearer
configuration = onelogin.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)


# Enter a context with an instance of the API client
with onelogin.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = default_api.DefaultApi(api_client)
    user_id = 1 # int | Set to the id of the user.
    activate_factor_request = ActivateFactorRequest(
        device_id=1,
        expires_in=1,
        redirect_to="redirect_to_example",
        custom_message="custom_message_example",
    ) # ActivateFactorRequest | 
    authorization = "Authorization_example" # str | Must be in the form of 'bearer <access_token>' (optional)

    try:
        api_response = api_instance.activate_factor(user_id, activate_factor_request, authorization=authorization)
        pprint(api_response)
    except onelogin.ApiException as e:
        print("Exception when calling DefaultApi->activate_factor: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.us.onelogin.com

Class Method HTTP request Description
DefaultApi activate_factor POST /api/2/mfa/users/{user_id}/verifications
DefaultApi add_access_token_claim POST /api/2/api_authorizations/{id}/claims
DefaultApi add_client_app POST /api/2/api_authorizations/{id}/clients
DefaultApi add_role_admins POST /api/2/roles/{role_id}/admins
DefaultApi add_role_users POST /api/2/roles/{role_id}/users
DefaultApi add_scope POST /api/2/api_authorizations/{id}/scopes
DefaultApi bulk_mapping_sort PUT /api/2/apps/mappings/sort
DefaultApi bulk_sort PUT /api/2/apps/{app_id}/rules/sort
DefaultApi create_app POST /api/2/apps
DefaultApi create_authorization_server POST /api/2/api_authorizations
DefaultApi create_environment_variable POST /api/2/hooks/envs
DefaultApi create_hook POST /api/2/hooks
DefaultApi create_mapping POST /api/2/mappings
DefaultApi create_risk_rule POST /api/2/risk/rules
DefaultApi create_roles POST /api/2/roles
DefaultApi create_rule POST /api/2/apps/{app_id}/rules
DefaultApi create_session_login_token POST /api/1/login/auth
DefaultApi create_user POST /api/2/users
DefaultApi delete_access_token_claim DELETE /api/2/api_authorizations/{id}/claims/{claim_id}
DefaultApi delete_app DELETE /api/2/apps/{app_id}
DefaultApi delete_app_parameter DELETE /api/2/apps/{app_id}/parameters/{parameter_id}
DefaultApi delete_authorization_server DELETE /api/2/api_authorizations/{id}
DefaultApi delete_environment_variable DELETE /api/2/hooks/envs/{envvar_id}
DefaultApi delete_factor DELETE /api/2/mfa/users/{user_id}/devices/{device_id}
DefaultApi delete_hook DELETE /api/2/hooks/{hook_id}
DefaultApi delete_mapping DELETE /api/2/mappings/{mapping_id}
DefaultApi delete_risk_rule DELETE /api/2/risk/rules/{risk_rule_id}
DefaultApi delete_role DELETE /api/2/roles/{role_id}
DefaultApi delete_rule DELETE /api/2/apps/{app_id}/rules/{rule_id}
DefaultApi delete_scope DELETE /api/2/api_authorizations/{id}/scopes/{scope_id}
DefaultApi delete_user DELETE /api/2/users/{user_id}
DefaultApi dry_run_mapping POST /api/2/mappings/{mapping_id}/dryrun
DefaultApi enroll_factor POST /api/2/mfa/users/{user_id}/registrations
DefaultApi generate_mfa_token POST /api/2/mfs/users/{user_id}/mfa_token
DefaultApi generate_saml_assertion POST /api/2/saml_assertion
DefaultApi generate_token POST /auth/oauth2/v2/token
DefaultApi get_app GET /api/2/apps/{app_id}
DefaultApi get_authorization_server GET /api/2/api_authorizations/{id}
DefaultApi get_available_factors GET /api/2/mfa/users/{user_id}/factors
DefaultApi get_client_apps GET /api/2/api_authorizations/{id}/clients
DefaultApi get_enrolled_factors GET /api/2/mfa/users/{user_id}/devices
DefaultApi get_environment_variable GET /api/2/hooks/envs/{envvar_id}
DefaultApi get_event_by_id GET /api/1/events/{event_id}
DefaultApi get_event_types GET /api/1/events/types
DefaultApi get_events GET /api/1/events
DefaultApi get_group_by_id GET /api/1/groups/{group_id}
DefaultApi get_groups GET /api/1/groups
DefaultApi get_hook GET /api/2/hooks/{hook_id}
DefaultApi get_logs GET /api/2/hooks/{hook_id}/logs
DefaultApi get_mapping GET /api/2/mappings/{mapping_id}
DefaultApi get_rate_limit GET /auth/rate_limit
DefaultApi get_risk_rule GET /api/2/risk/rules/{risk_rule_id}
DefaultApi get_risk_score POST /api/2/risk/verify
DefaultApi get_role GET /api/2/roles/{role_id}
DefaultApi get_role_admins GET /api/2/roles/{role_id}/admins
DefaultApi get_role_apps GET /api/2/roles/{role_id}/apps
DefaultApi get_role_users GET /api/2/roles/{role_id}/users
DefaultApi get_rule GET /api/2/apps/{app_id}/rules/{rule_id}
DefaultApi get_score_insights GET /api/2/risk/scores
DefaultApi get_user GET /api/2/users/{user_id}
DefaultApi get_user_apps GET /api/2/users/{user_id}/apps
DefaultApi list_access_token_claims GET /api/2/api_authorizations/{id}/claims
DefaultApi list_action_values GET /api/2/apps/{app_id}/rules/actions/{action_value}/values
DefaultApi list_actions GET /api/2/apps/{app_id}/rules/actions
DefaultApi list_app_users GET /api/2/apps/{app_id}/users
DefaultApi list_apps GET /api/2/apps
DefaultApi list_authorization_servers GET /api/2/api_authorizations
DefaultApi list_condition_operators GET /api/2/apps/{app_id}/rules/conditions/{condition_value}/operators
DefaultApi list_condition_values GET /api/2/apps/{app_id}/rules/conditions/{condition_value}/values
DefaultApi list_conditions GET /api/2/apps/{app_id}/rules/conditions
DefaultApi list_connectors GET /api/2/connectors
DefaultApi list_environment_variables GET /api/2/hooks/envs
DefaultApi list_hooks GET /api/2/hooks
DefaultApi list_mapping_action_values GET /api/2/apps/mappings/actions/{action_value}/values
DefaultApi list_mapping_actions GET /api/2/apps/mappings/actions
DefaultApi list_mapping_condition_operators GET /api/2/apps/mappings/conditions/{condition_value}/operators
DefaultApi list_mapping_condition_values GET /api/2/apps/mappings/conditions/{condition_value}/values
DefaultApi list_mapping_conditions GET /api/2/apps/mappings/conditions
DefaultApi list_mappings GET /api/2/mappings
DefaultApi list_risk_rules GET /api/2/risk/rules
DefaultApi list_roles GET /api/2/roles
DefaultApi list_rules GET /api/2/apps/{app_id}/rules
DefaultApi list_scopes GET /api/2/api_authorizations/{id}/scopes
DefaultApi list_users GET /api/2/users
DefaultApi remove_client_app DELETE /api/2/api_authorizations/{id}/clients/{client_app_id}
DefaultApi remove_role_admins DELETE /api/2/roles/{role_id}/admins
DefaultApi remove_role_users DELETE /api/2/roles/{role_id}/users
DefaultApi revoke_token POST /auth/oauth2/revoke
DefaultApi set_role_apps PUT /api/2/roles/{role_id}/apps
DefaultApi track_event POST /api/2/risk/events
DefaultApi update_access_token_claim PUT /api/2/api_authorizations/{id}/claims/{claim_id}
DefaultApi update_app PUT /api/2/apps/{app_id}
DefaultApi update_authorization_server PUT /api/2/api_authorizations/{id}
DefaultApi update_client_app PUT /api/2/api_authorizations/{id}/clients/{client_app_id}
DefaultApi update_environment_variable PUT /api/2/hooks/envs/{envvar_id}
DefaultApi update_hook PUT /api/2/hooks/{hook_id}
DefaultApi update_mapping PUT /api/2/mappings/{mapping_id}
DefaultApi update_risk_rule PUT /api/2/risk/rules/{risk_rule_id}
DefaultApi update_role PUT /api/2/roles/{role_id}
DefaultApi update_rule PUT /api/2/apps/{app_id}/rules/{rule_id}
DefaultApi update_scope PUT /api/2/api_authorizations/{id}/scopes/{scope_id}
DefaultApi update_user PUT /api/2/users/{user_id}
DefaultApi v1_verify_factor POST /api/1/login/verify_factor
DefaultApi verify_enrollment PUT /api/2/mfa/users/{user_id}/registrations/{registration_id}
DefaultApi verify_enrollment_voice_protect GET /api/2/mfa/users/{user_id}/registrations/{registration_id}
DefaultApi verify_factor PUT /api/2/mfa/users/{user_id}/verifications/{verification_id}
DefaultApi verify_factor_saml POST /api/2/saml_assertion/verify_factor
DefaultApi verify_factor_voice GET /api/2/mfa/users/{user_id}/verifications/{verification_id}

Documentation For Models

Documentation For Authorization

bearer

  • Type: Bearer authentication

Author

support@onelogin.com

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in onelogin.apis and onelogin.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from onelogin.api.default_api import DefaultApi
  • from onelogin.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import onelogin
from onelogin.apis import *
from onelogin.models import *