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

update the readme #40

Open
gabrielsroka opened this issue May 3, 2024 · 4 comments
Open

update the readme #40

gabrielsroka opened this issue May 3, 2024 · 4 comments

Comments

@gabrielsroka
Copy link
Contributor

gabrielsroka commented May 3, 2024

# Use SSWS token instead of access token.
$Configuration = Get-OktaConfiguration
$Configuration.BaseUrl = 'https://YOURORG.okta.com'
$Configuration.DefaultHeaders = @{authorization = 'SSWS ...'}

Get-OktaUser me

New-OktaUser @{
  profile = @{
    firstName = 'Okta'
    lastName = 'CLI'
    login = '[email protected]'
    email = '[email protected]'
  }
}

# To get pagination to work is a little wonky using the example in the README.
# https://github.com/okta/okta-powershell-cli#list-users-with-pagination
$page = Invoke-OktaListUsers -WithHttpInfo -Filter 'profile.lastName eq "Doe"'
$users = $page.response
foreach ($user in $users) {
    write-host $user.id $user.profile.login
}
While ($page.NextPageUri) {
    # This time you can pass the absolute Uri with already contains query params such as "limit" and/or "after".
    $page = Invoke-OktaListUsers -Uri $page.NextPageUri -withHttpInfo
    $users = $page.response
    # have to repeat this loop from above....
    foreach ($user in $users) {
        write-host $user.id $user.profile.login
    }
}

# Using splatting is less redundant and more elegant (imho). this is how i did it in my pwsh module, too.
# based on https://github.com/gabrielsroka/OktaAPI.psm1#usage
$params = @{WithHttpInfo = $true; Filter = 'profile.lastName eq "Doe"'}
do {
    $page = Invoke-OktaListUsers @params
    $users = $page.response
    foreach ($user in $users) {
        write-host $user.id $user.profile.login
    }
    # This time you can pass the absolute Uri which already contains query params such as "limit" and/or "after".
    $params = @{uri = $page.NextPageUri; WithHttpInfo = $true}
} while ($page.NextPageUri)
@gabrielsroka
Copy link
Contributor Author

also, after creating the app, assign yourself to it. i'm not sure it's in the docs (if it is, i might have missed it)

@gabrielsroka
Copy link
Contributor Author

on

and

if (IsJsonMIME -MIME $ContentType) { # JSON

what is -MIME ?

@laura-rodriguez
Copy link
Collaborator

@gabrielsroka Thanks for the feedback!
We're currently collecting feedback through multiple channels and plan to revisit the readme to make it clearer.

Internal Ref: OKTA-727813

@laura-rodriguez laura-rodriguez pinned this issue May 9, 2024
@laura-rodriguez laura-rodriguez unpinned this issue May 9, 2024
@laura-rodriguez
Copy link
Collaborator

Related to #36

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

No branches or pull requests

2 participants