You must use HTTPS while generating Kong client credentials - docker

Can anyone please help me out. I'm getting error while generating KONG client credentials on HTTP port 8000.
{
"error_description": "You must use HTTPS",
"error": "access_denied"
}
I have added trusted_ips = 0.0.0.0/0,::/0 in kong.conf also, but it didn't work.

You should do it over https(using port 8443 instead of 8000).If youre using localhost Do something like:
curl -X POST \
--url "https://127.0.0.1:8443/<route name>/oauth2/token " \
--header "Host: <route host>" \
--data "grant_type=password" \
--data "client_id=<clientid>" \
--data "client_secret=<clientsecret>" \
--data "provision_key=<provision_key>"\
--data "redirect_uri=http://localhost/cb/" \
--data "authenticated_userid=<userid>" \
--insecure
you can follow this link for further details on how to go about this

Related

How Get a 2 Legged Token Autodesk?

I need to get "Get a 2-Legged Token" verification for a read-only access to upload files entered by other users but I'm running into the following error:
{
"developerMessage": "The required parameter(s) client_id,client_secret,grant_type not present in the request",
"errorCode": "AUTH-008",
"more info": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/"
}
I followed exactly the example on the site changing just my "client id" and my "client secret":
https://forge.autodesk.com/en/docs/oauth/v1/tutorials/get-2-legged-token/
can anybody help me?
The single quote is wrong format in header of curl.
Try this format
curl --location --request POST 'https://developer.api.autodesk.com/authentication/v1/authenticate' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'client_id=your_client_id_xxx' \
-d 'client_secret=your_client_secret_xxx' \
-d 'grant_type=client_credentials' \
-D 'scope=data:read'
It will be return access token
I am using Postman for HTTP call.
It is more convenient

Cookies don't work in dart but curl generated by CurlLoggerDioInterceptor works in shell

I have in my Flutter project APIs that use cookies and they don't work. I have enabled the interceptor that generates the curl:
CurlLoggerDioInterceptor (printOnSuccess: true)
with the following result:
curl -i \
-H "Accept: application / json" \
-H "Connection: keep-alive" \
-H "cookie: ci_session = uv0hts7fb8us0r7m5vvaa64p4o89u9he" \
-H "Authorization: 1652292531" \
"http://xxxxx.it"
And this works on shell. I don't understand, why the curl generated by Dart code works and the code itself doesn't work?
Regarding the code I've used all the solutions in this link (dio_cookie_manager, NetworkService, HTTP request instead of dio...) How do I make an http request using cookies on flutter?
With Dio is not possible, but with the following library yes:
flutter_curl: ^0.1.1

Mendeley - can not search catalog anymore "client is not allowed"

Since last week, the catalog search on Mendeley API is giving me the following result:
{
"message": "Client ID <client_id> is not allowed",
"status": 403
}
I am using standard code in Python that worked before:
mendel = Mendeley(client_id=client_id, client_secret=client_secret)
auth = mendel.start_client_credentials_flow()
session = auth.authenticate()
print(session.catalog.search('Nitrogen dynamics', view='all').list(50).items)
And I have the same result using curl:
curl -X POST \
-H "Content-Type: application/x-www-form-urlencoded" \
-u client_id:client_secret \
-d "grant_type=client_credentials&scope=all" \
https://api.mendeley.com/oauth/token
curl -X GET "https://api.mendeley.com/search/catalog?access_token={access_token}"

Keycloak 11.0.0 generating token scope parameter invalid

I'm in the process of updating Keycloak straight from version 6.0.1 to 11.0.0, the db migration was successful and was able to login into admin console, however the token generation seems to be broken, I'm sending below curl to generate token
curl --location --request POST 'http://localhost:8480/auth/realms/test/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=testUser' \
--data-urlencode 'password=testPassword' \
--data-urlencode 'scope=testRole' \
--data-urlencode 'client_id=testService' \
--data-urlencode 'client_secret=testServiceSecret'
On sending above request Keycloak complains of Invalid Scopes: testRole, however I've verified the role and user role mappings are in place and this used to work well with Keycloak 6.0.1.
Just on side note, our clients are Full scoped, so it something that is causing issue? Or something else have got changed or is there a way to ignore invalid scopes altogether while generating token?

Cloud Speech API error: RecognitionAudio not set

While trying to follow the [quick start] (https://cloud.google.com/speech/docs/getting-started) for cloud speed API, after execute the "curl" command in command prompt, error occurred depicted as below:
{
"error": {
"code": 400,
"message": "RecognitionAudio not set.",
"status": "INVALID_ARGUMENT"
}
}
Why the RecognitionAudio is not set in the API itself? The sync-request.json used is same as the one in the quick start:
{
"config": {
"encoding":"FLAC",
"sampleRateHertz": 16000,
"languageCode": "en-US",
"enableWordTimeOffsets": false
},
"audio": {
"uri":"gs://cloud-samples-tests/speech/brooklyn.flac"
}
}
I'm not sure exactly what you're doing wrong but I was able to use the request as-is from the documentation without issue.
Did you get an access token for a Google Cloud project that had the speech API enabled? The following command generates the access token that can be used as a Bearer:
gcloud auth application-default print-access-token
It was helpful for me to use put the following into a script file (req.sh)
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer <output>" \
https://speech.googleapis.com/v1/speech:recognize \
-d #sync-request.json
I then just used the output from print-access-token with the script.
I had exactly the same problem and I solved it adding quotes in the -d value, like this:
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer <your-access-token>" \
https://speech.googleapis.com/v1/speech:recognize \
-d "#sync-request.json"
I was getting this error because I was not running the command in the cli in the same directory as my sync-request.json file.
Once I changed directories, I used the command from the documentation with my access token, and it worked fine.
I had the same problem and it worked for me when I omitted the #sync- from the curl command. This command worked for me:
curl -s -H "Content-Type: application/json" \
-H "Authorization: Bearer " \
https://speech.googleapis.com/v1/speech:recognize \
-d #request.json
Not sure what the exact function is of #sync ?

Resources