Why I can't use API for common user integrated with OIDC in ICP(IBM cloud private) - ibm-cloud-private

https://www.ibm.com/support/knowledgecenter/SSBS6K_2.1.0/apis/auth_manage_api.html
I try to use the API for common user integrated with OIDC, but the error msg shows:
{"error_description":"invalid_resource_owner_credential","error":"server_error"}
command as the following
curl -k -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -d "grant_type=password&username=abc\#test\.com&password=ChangeMe\!\#\#&scope=openid" https://<cluster_access_ip>:8443/idprovider/v1/auth/identitytoken --insecure
But it is working fine for the administrator: admin/admin, so strange.

Issue is with the special character "!" which is used for history expansions in command line prompt.
You can use below command which works...
curl -k -H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" -d "grant_type=password&username=abc#test.com&password=ChangeMe"'!'"##&scope=openid" https://<cluster_access_ip>:8443/idprovider/v1/auth/identitytoken --insecure

Have you configured the LDAP, created Teams and added users to the team? Did you check the logs on Master node /var/log/containers for platform-identity-manager, _platform-auth-service, *platform-identity-provider?

Related

Telegram example of how to use CURL for windows 10 to message myself with a bot

I found the following curl example to use a telegram bot to message a user. But that is written in PHP.
Is there an example of how to use the curl command in windows 10 command prompt to send a message to myself in telegram messenger?
You haven't mentioned the PHP code, but using CURL you can simply call:
curl https://api.telegram.org/bot123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11/sendMessage?chat_id=1234&text=hi
Replace 123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11 with your own bot token and 1234 with your id. Don't forget to start the bot before messaging yourself.
Those who landed here due to above method is not working anymore -> you can use curl POST request like the following:
curl -s -o /dev/null -X POST -H "Content-Type: application/json" -d "{\"chat_id\": \"-100XXXXXXXXXX\", \"text\": \"test_message\", \"disable_notification\": false}" https://api.telegram.org/bot{API_TOKEN}/sendMessage
Where
-s - Silent mode,
-o /dev/null - redirect result output to nowhere, in case where the command is not working remove the argument to find possible cause,
disable_notification: false - send the message silently without telegram notification.
For those who really likes .bat/.sh scripts there is an option to put the command into a .bat/.sh script, replace test_message with %~1/$1 placeholders respectively and execute the script with message argument like:
. ./sendMessage.sh "Specific message having spaces"
or
. ./sendMessage.sh singleWordWithoutSpaces

curl pull request error - fork_collab Fork collab can't be granted by someone without permission

I'm trying to automate github pull requests via bash script, specifically raising pull requests for forked branches. I've successfully done it for private repos, however it doesn't seem to work for public repos (see code below):
curl -H "Authorization: bearer <accesstoken>" -d '{"title":"SOMETITLE","base":"master","head":"'"someuser"':'"someForkedBranch"'","body":"some words to fill body."}' https://api.github.com/repos/<user-name>/<repo-name>/pulls
Any help would be appreciated.
If this is for creating a PR, you would need a -X POST somewhere in your curl command, in order to POST the query for a new PR:
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/octocat/hello-world/pulls \
-d '{"head":"head","base":"base"}'
Make sure also to use the right oauth/PAT or SAML SSO:
curl -v -H "Authorization: token TOKEN" -X POST ...
Those token have just seen a new format update (Apr. 2021) so you might need to regenerate one.

Jira API GET all users from Jira project with specific status

In my Ruby app I'm trying to get all agent users from my service desk board. It means all users with status: 'ServiceDesk'. Is it possible using only base auth?
In curl I was trying something like:
curl -D -u USERNAME:PASSWORD -X GET -H "Content-Type: application/json" https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK
But all what I get is an error:
Warning: The file name argument '-u' looks like a flag.
curl: (3) URL using bad/illegal format or missing URL
{"errorMessages":["Internal server error"],"errors":{}}%
Is there any way to get those data with basic auth?
I think there's an issue with the curl command, try this
curl -D- -u USERNAME:PASSWORD https://company_name.atlassian.net/rest/api/2/user/assignable/search?project=SERVICEDESK

curl in windows read function returned funny value

I am using the following command to upload file to an endpoint
curl -X POST -H "authorization: Basic base64encode" -H "Content-Type:
multipart/form-data" -H "X-Atlassian-Token: nocheck" -F
"file=#c:/Users/User/Desktop/testresults.xml" https://jira.test-
server.ag/rest/api/latest/issue/man-287/attachments
the command under mac works without problems, under windows I become the following error
curl: (26) read function returned funny value
curl version
curl 7.64.0 (x86_64-w64-mingw32) libcurl/7.64.0 OpenSSL/1.1.1a
installed using https://chocolatey.org
I ran into the same problem when I used curl on the Windows Subsystem for Linux on Windows 10. I had to change the path from C:\Temp\File.txt to /mnt/c/Temp/File.txt.
Check if you can access the file in your shell e.g. with dir c:\path\to\file.txt and if it fails then you know that you have to fix the path first.

Curl command on windows not passing user:pass correctly

I'm using CURL to execute some API calls against a bitbucket server. The command is like this:
curl https://bitbucket.myserver.com/rest/api/1.0/projects/PRJ/repos/repo-slug/tags \
-u 'user:pass' \
-X POST \
-H 'Content-type: application/json' \
-d '{"name" : "test-tag", "message": "Test tag from curl", "startPoint": "master" }'
This is expected to create a tag on the master branch in the repo. This however fails complaining of incorrect username/password.
I then copy/paste the command into git-bash prompt - and it works as expected, completing successfully. I tried this with multiple user accounts. I also tried specifying only the username and then entering the password on command line - with the same results.
How can I get curl on windows to pass correct username/password to the server?

Resources