Skip to content

Commit

Permalink
Merge pull request #323 from BarondeCharlus/fix-readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bretterer authored Mar 13, 2023
2 parents 3159e27 + 4a0f396 commit 8743938
Showing 1 changed file with 27 additions and 12 deletions.
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[<img src="https://aws1.discourse-cdn.com/standard14/uploads/oktadev/original/1X/0c6402653dfb70edc661d4976a43a46f33e5e919.png" align="right" width="256px"/>](https://devforum.okta.com/)
[<img src="https://global.discourse-cdn.com/oktadev/original/1X/0c6402653dfb70edc661d4976a43a46f33e5e919.png" align="right" width="256px"/>](https://devforum.okta.com/)
[![Build Status](https://img.shields.io/travis/okta/okta-sdk-python.svg?logo=travis)](https://travis-ci.org/okta/okta-sdk-python)
![Beta Release](https://img.shields.io/badge/Beta-Upcoming-inactive.svg)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
Expand Down Expand Up @@ -91,6 +91,7 @@ loop.run_until_complete(main())
```

Another way to instantiate okta_client (config should be provided in other place as described below):

```py
# Instantiating without in-text credentials
okta_client = OktaClient()
Expand Down Expand Up @@ -157,6 +158,7 @@ loop.run_until_complete(main())
```

Note, that privateKey can be passed in JWK format or in PEM format, i.e. (examples generated with https://mkjwk.org):

```
{
"p": "4VmEO2ztlIHvalMHX797rWhETbKgB6bRbdGevYpRLZH167hKHB5vsuRjIAXJdujQw8W3rnas9Z-_Ddv1TbR5Qnz0UmhnxQAIbdDDUE9r5P_LEholrjY9Jz0P-W4jey-7cDATeITYHb3t67HcIwVbxQF5fkRdJAhfO029RqkH3OE",
Expand All @@ -173,7 +175,9 @@ Note, that privateKey can be passed in JWK format or in PEM format, i.e. (exampl
"n": "r95K3WIN8-4dB-tEKHjyTIIZZUMbHz8ad5oBX2BGiGxfPGfHbz2RH4QLT9ffzL-tgEo8IKs0Myh0VTwauiwz0cdHuS2gUTasK9OsosX1h1scSu_eZ-g-__lXBogU-SvBXBAgjv8hdcZjqWYQwmhJp2Ilv0CuXKxQwZyjso775PDjWDCH5HkVcSxHyUvpThLfWfkfz5PNDZvRpuPltv55ILRaVZhwPb7VXLAm2ebfeYUdybUKpGnEogKQdaL7TdNvP-HRnUSXTiYeXWHzU04FaXJ7yLmtXOQ52FT9dwkwLrCDOmDSBGafZ9asUtgOKhKN6wQW5mndhMK_1zThfjZyxQ"
}
```

or

```
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv3krdYg3z7h0H
Expand Down Expand Up @@ -268,6 +272,7 @@ class CacheImpl(Cache):
```

A similar approach can be used to extend `okta.request_executor`:

```py
from okta.request_executor import RequestExecutor

Expand Down Expand Up @@ -311,6 +316,7 @@ class RequestExecImpl(RequestExecutor):
```

and `okta.http_client`:

```py
from okta.http_client import HTTPClient

Expand Down Expand Up @@ -377,6 +383,7 @@ This library should only be used with the Okta management API. To call the [Auth
### Get and set custom attributes
Custom attributes must first be defined in the Okta profile editor. Then, you can work with custom attributes on a user:
> Feature is fully supported with SDK version >= 1.2.0
```py
Expand Down Expand Up @@ -406,6 +413,7 @@ user_profile.customAttr = 'custom value'
**NOTE**: Custom Attributes case must be the same as defined in the Profile tab of your organization UI.

To maintain consistent code, you can use camelCase for all default attributes:

> Feature is fully supported with SDK version >= 1.6.1
```py
Expand Down Expand Up @@ -466,7 +474,9 @@ async def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```

Output should look like the following (removed pre-existing users from output):

```sh
John Smith
custom value
Expand Down Expand Up @@ -694,8 +704,9 @@ app, resp, err = await client.create_application(swa_app_model)
### Manage Group Schema custom atributes

There are 2 ways of creating custom attribute for Group Schema Profile:
1) via UI of your ORG (Directory -> Profile Editor -> Groups)
2) with the following request (create custom attribute with name "testCustomAttr"):

1. via UI of your ORG (Directory -> Profile Editor -> Groups)
2. with the following request (create custom attribute with name "testCustomAttr"):

```py
definition = {'custom':
Expand Down Expand Up @@ -846,13 +857,16 @@ async def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
```

Result should look like:

```py
{'errorCode': 'E0000011', 'errorSummary': 'Invalid token provided', 'errorLink': 'E0000011', 'errorId': 'oaeqWcqizEUQ_-iHc2hCbH9LA', 'errorCauses': []}
```

List of available exceptions: OktaAPIException, HTTPException (to raise instead of returning errors OktaAPIError and HTTPError respectively).
It is possible to inherit and/or extend given exceptions:

```py
from okta.exceptions import HTTPException

Expand Down Expand Up @@ -891,6 +905,7 @@ except StopAsyncIteration:
```

Here's a complete example:

```python
from okta.client import Client as OktaClient
import asyncio
Expand Down Expand Up @@ -938,6 +953,7 @@ client = OktaClient(config)
**NOTE**: DO NOT SET DEBUG LEVEL IN PRODUCTION!

Here's a complete example:

```python
from okta.client import Client as OktaClient
import asyncio
Expand All @@ -957,7 +973,6 @@ You should now see logs in your console. Actual API Tokens will be logged to the

What it being logged: requests, http errors, caching responses.


## Configuration reference

This library looks for configuration in the following sources:
Expand All @@ -981,10 +996,10 @@ okta:
connectionTimeout: 30 # seconds
orgUrl: "https://{yourOktaDomain}"
proxy:
port: {proxy_port}
host: {proxy_host}
username: {proxy_username}
password: {proxy_password}
port: { proxy_port }
host: { proxy_host }
username: { proxy_username }
password: { proxy_password }
token: "YOUR_API_TOKEN"
requestTimeout: 0 # seconds
rateLimit:
Expand All @@ -1002,10 +1017,10 @@ okta:
connectionTimeout: 30 # seconds
orgUrl: "https://{yourOktaDomain}"
proxy:
port: {proxy_port}
host: {proxy_host}
username: {proxy_username}
password: {proxy_password}
port: { proxy_port }
host: { proxy_host }
username: { proxy_username }
password: { proxy_password }
authorizationMode: "PrivateKey"
clientId: "YOUR_CLIENT_ID"
scopes:
Expand Down

0 comments on commit 8743938

Please sign in to comment.