Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for ApiKey configuration fields not working for the API functions (#52) #53

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TriggerAu
Copy link
Contributor

Note: This fix is premised on an assumption that the ApiKey parameter in the Configuration object is meant to be an ApiToken from the management interface, based on the details in the management.yaml (more in the bug report).

If the fix should be to add an extra attribute called ApiToken to the Configuration object let me know and Ill adjust the PR

I kept the work in two commits:

  • The openapi mustache template changes for the config and api calls
  • The generated ps1 files

Changes

  • ApiKey is now a string instead of a hashtable and takes the apiToken that is generated in the admin interface
  • ApiKeyPrefix is now a string instead of a hashtable and defaults to SSWS
  • The logic in the methods for ApiKey uses it in the Authorization portion of the request header for the api per the API docs: Authorization: SSWS {API Token}

The usage of this method is as below:

$Configuration = Get-OktaConfiguration
$Configuration.BaseUrl = 'https://myorg.okta.com'
$Configuration.ApiKey = 'myApiToken'
Invoke-OktaListUsers

the ApiKeyPrefix defaults to the SSWS value from the documentation

Issue #52

Other Note: Im not sure how the team maintain/ask contributors to adjust the version/build log, but if there is anything I can do to help in that regard just lemme know

These will change the module files so that if the ApiKey/Prefix is set then
the PS Module calls will use the ApiKey to set the Authorization header
using the encoding specified by the management APIs to be able to use at Okta

`Authorization: SSWS {API Token}`
…3 generator

This implements the fix in all the modules through the use of the generator via
```
openapi-generator-cli generate -g powershell -c config.json --skip-validate-spec
```

It changes the Configuration object so that the ApiKey and ApiKeyPrefix are strings
and not hashtables, and deploys the changed usage to all the API calls that had
code that will use them
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant