okta-token-fetcher


Nameokta-token-fetcher JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/mathewmoon/okta-token-fetcher
SummaryUsed to fetch OKTA tokens for an application using web a browser that redirects to a commandline server
upload_time2024-03-12 15:14:04
maintainer
docs_urlNone
authorMathew Moon
requires_python>=3.8,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # okta-token-fetcher

Provides a commandline script and package for getting an OKTA id_token by interacting with your browser via the commandline.

This script builds off of the dirty quick way to get a token from your browser stated here:
https://developer.okta.com/docs/guides/implement-oauth-for-okta/main/#get-an-access-token-and-make-a-request .

This is done by opening a browser window that navigates to the auth server with localhost as the redirect_uri. There
is an http server that is spun up for just long enough to handle the redirect request and get the id_token from the
query parameters that are sent via window.hash (I suppose OKTA does this so that it can't be sent to the server itself).
Tokens are cached in the OS keyring unless --no-cache is set.
  
Your OKTA application MUST have "http://localhost:8888" configured as one of the allowed redirect uri's for this tool to work.

## As a terminal script:

```
usage: okta-fetch [-h] -i ISSUER -c CLIENT_ID [-s SCOPES] [-t TOKEN_TYPE] [--no-cache] [-S KEYCHAIN_SERVICE] [-u KEYCHAIN_USERNAME] [-r FINAL_REDIRECT] [-I]

options:
  -h, --help            show this help message and exit
  -i ISSUER, --issuer ISSUER
                        The auth server url. This should be only the domain and protocol. eg: https://mydomain.okta.com
  -c CLIENT_ID, --client-id CLIENT_ID
                        The client id to get a token for
  -s SCOPES, --scopes SCOPES
                        Comma delimited list of scopes to request
  -t TOKEN_TYPE, --token-type TOKEN_TYPE
                        The type of token to request
  --no-cache            Don't cache the token
  -S KEYCHAIN_SERVICE, --keychain-service KEYCHAIN_SERVICE
                        Service name to use when caching tokens to the OS keychain. Defaults to the issuer
  -u KEYCHAIN_USERNAME, --keychain-username KEYCHAIN_USERNAME
                        Username to use when caching tokens to the OS keychain. Defaults to the client ID
  -r FINAL_REDIRECT, --final-redirect FINAL_REDIRECT
                        This is where the browser will be redirected to at the end of the auth flow
  -I, --info            Print info about the token

    This script builds off of the dirty quick way to get a token from your browser stated here:
    https://developer.okta.com/docs/guides/implement-oauth-for-okta/main/#get-an-access-token-and-make-a-request .

    This is done by opening a browser window that navigates to the auth server with localhost as the redirect_uri. There
    is an http server that is spun up for just long enough to handle the redirect request and get the token from the
    query parameters that are sent via window.hash.

    Your OKTA application MUST have "http://localhost:8888" configured as one of the allowed redirect uri's for this tool to work.
```

# Implemented in another script:

```
fetcher = OktaToken(
    issuer="https://my-okta-org.okta.com/8a88fje02348ljajr8,
    client_id=my-oidc-app-client-id,
    final_redirect="https://github.com",
    token_type="token",
    use_keychain=True,
)
print(fetcher.token)
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/mathewmoon/okta-token-fetcher",
    "name": "okta-token-fetcher",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Mathew Moon",
    "author_email": "me@mathewmoon.net",
    "download_url": "https://files.pythonhosted.org/packages/79/15/a265e00ca5d7b6c521adf3bf639c56e1157c618a419021dc8c9a50a57426/okta_token_fetcher-0.1.2.tar.gz",
    "platform": null,
    "description": "# okta-token-fetcher\n\nProvides a commandline script and package for getting an OKTA id_token by interacting with your browser via the commandline.\n\nThis script builds off of the dirty quick way to get a token from your browser stated here:\nhttps://developer.okta.com/docs/guides/implement-oauth-for-okta/main/#get-an-access-token-and-make-a-request .\n\nThis is done by opening a browser window that navigates to the auth server with localhost as the redirect_uri. There\nis an http server that is spun up for just long enough to handle the redirect request and get the id_token from the\nquery parameters that are sent via window.hash (I suppose OKTA does this so that it can't be sent to the server itself).\nTokens are cached in the OS keyring unless --no-cache is set.\n  \nYour OKTA application MUST have \"http://localhost:8888\" configured as one of the allowed redirect uri's for this tool to work.\n\n## As a terminal script:\n\n```\nusage: okta-fetch [-h] -i ISSUER -c CLIENT_ID [-s SCOPES] [-t TOKEN_TYPE] [--no-cache] [-S KEYCHAIN_SERVICE] [-u KEYCHAIN_USERNAME] [-r FINAL_REDIRECT] [-I]\n\noptions:\n  -h, --help            show this help message and exit\n  -i ISSUER, --issuer ISSUER\n                        The auth server url. This should be only the domain and protocol. eg: https://mydomain.okta.com\n  -c CLIENT_ID, --client-id CLIENT_ID\n                        The client id to get a token for\n  -s SCOPES, --scopes SCOPES\n                        Comma delimited list of scopes to request\n  -t TOKEN_TYPE, --token-type TOKEN_TYPE\n                        The type of token to request\n  --no-cache            Don't cache the token\n  -S KEYCHAIN_SERVICE, --keychain-service KEYCHAIN_SERVICE\n                        Service name to use when caching tokens to the OS keychain. Defaults to the issuer\n  -u KEYCHAIN_USERNAME, --keychain-username KEYCHAIN_USERNAME\n                        Username to use when caching tokens to the OS keychain. Defaults to the client ID\n  -r FINAL_REDIRECT, --final-redirect FINAL_REDIRECT\n                        This is where the browser will be redirected to at the end of the auth flow\n  -I, --info            Print info about the token\n\n    This script builds off of the dirty quick way to get a token from your browser stated here:\n    https://developer.okta.com/docs/guides/implement-oauth-for-okta/main/#get-an-access-token-and-make-a-request .\n\n    This is done by opening a browser window that navigates to the auth server with localhost as the redirect_uri. There\n    is an http server that is spun up for just long enough to handle the redirect request and get the token from the\n    query parameters that are sent via window.hash.\n\n    Your OKTA application MUST have \"http://localhost:8888\" configured as one of the allowed redirect uri's for this tool to work.\n```\n\n# Implemented in another script:\n\n```\nfetcher = OktaToken(\n    issuer=\"https://my-okta-org.okta.com/8a88fje02348ljajr8,\n    client_id=my-oidc-app-client-id,\n    final_redirect=\"https://github.com\",\n    token_type=\"token\",\n    use_keychain=True,\n)\nprint(fetcher.token)\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Used to fetch OKTA tokens for an application using web a browser that redirects to a commandline server",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/mathewmoon/okta-token-fetcher",
        "Repository": "https://github.com/mathewmoon/okta-token-fetcher"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0286cadad109c18896142ac851ec60d6f18f2983786c2b486df99c516d514adf",
                "md5": "447c81970b68bb2c3aee2d21f0a2e0a9",
                "sha256": "a99c0f3e88a94830a5ed30ade6839fed7a303c419a99aef39dca19117c44cbce"
            },
            "downloads": -1,
            "filename": "okta_token_fetcher-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "447c81970b68bb2c3aee2d21f0a2e0a9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 6706,
            "upload_time": "2024-03-12T15:14:03",
            "upload_time_iso_8601": "2024-03-12T15:14:03.126230Z",
            "url": "https://files.pythonhosted.org/packages/02/86/cadad109c18896142ac851ec60d6f18f2983786c2b486df99c516d514adf/okta_token_fetcher-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7915a265e00ca5d7b6c521adf3bf639c56e1157c618a419021dc8c9a50a57426",
                "md5": "3b0a9f32b68fd338f6058ba1dd93b356",
                "sha256": "9d470cea51ad83584998762c24a50dfde82bf1b793fa8bd638d357e59b627711"
            },
            "downloads": -1,
            "filename": "okta_token_fetcher-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "3b0a9f32b68fd338f6058ba1dd93b356",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 5270,
            "upload_time": "2024-03-12T15:14:04",
            "upload_time_iso_8601": "2024-03-12T15:14:04.600191Z",
            "url": "https://files.pythonhosted.org/packages/79/15/a265e00ca5d7b6c521adf3bf639c56e1157c618a419021dc8c9a50a57426/okta_token_fetcher-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-12 15:14:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mathewmoon",
    "github_project": "okta-token-fetcher",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "okta-token-fetcher"
}
        
Elapsed time: 0.51345s