refreshing StubHub API tokens? - api

We are trying to refresh a previously working application's refresh tokens as per stub-hub's developers docs with the following commands (where <whatever> are account specific placeholders).
ENCRYPTED_ACCT=$(echo -n "<client-id>:<client-secret>" | base64);
curl -X POST "https://account.stubhub.com/oauth2/token" \
-u "${ENCRYPTED_ACCT}" --basic \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=refresh_token" \
-d "refresh_token=<PREV_REFRESH_TOKEN>" \
--data-urlencode "scope=read:events";
In the past we've followed a similar flow (api changed since). But now with the recommended procedure the endpoint is failing due to invalid credentials for the ENCRYPTED_ACCT. Can anyone post a functioning workflow to refresh tokens of an existing account?

Related

Nexmo API change on Text to Speech?

For a very long time I've been using the following to send text-to-speech alerts from my applications.
curl 'https://api-us-1.nexmo.com/tts/json' \
-d api_key=****** \
-d api_secret=****** \
-d to=0035193xxxxxxx \
-d from=0035193xxxxxxx \
--data-urlencode 'text=Alert! Check Something... ' \
-d repeat=2 \
-d voice="male" \
Very recently the service has stopped working for some carriers.
While going over Nexmo docs I can't see the /tts/json API documented.
Anyone knows what happened?
Is the /tts/json API still usable?
The /v1/calls API is absolutelly overkill for my needs.
Unfortunately that API was sunset quite a while ago and replaced with the newer Voice API.
https://developer.nexmo.com/voice/voice-api/code-snippets/make-an-outbound-call-with-ncco would the closest alternative with the Voice API. The biggest change is switching to using a JWT for authentication versus the key/secret auth the older API used.
If you have the Nexmo CLI installed you can generate a JWT as part of a script. The following should work:
#!/bin/bash
#
# Send voice message to a user
#
# ./script.sh <number to call> <vonage number> "<message to speak>"
PATH_TO_PRIVATE_KEY=<path to private key>
VONAGE_APPLICATION_ID=<application ID>
TO_NUMBER=$1
VONAGE_NUMBER=$2
MESSAGE=$3
JWT=$(nexmo jwt:generate $PATH_TO_PRIVATE_KEY application_id=$VONAGE_APPLICATION_ID)
curl -X POST https://api.nexmo.com/v1/calls\
-H "Authorization: Bearer "$JWT\
-H "Content-Type: application/json"\
-d "{\"to\":[{\"type\": \"phone\",\"number\": \"$TO_NUMBER\"}],
\"from\": {\"type\": \"phone\",\"number\": \"$VONAGE_NUMBER\"},
\"ncco\": [
{
\"action\": \"talk\",
\"text\": \"$MESSAGE\"
}
]}"

OneLogin API credentials

Im trying to make a basic call to the ONELOGIN API. After generating the cliend ID and secret with MANAGE ALL permissions, im still unable to connect
Generated correctly the ID and secret with the right permissions as per official documentation
curl 'https://api.us.onelogin.com/auth/oauth2/v2/token' \
-X POST \
-H "Authorization: client_id:, client_secret:" \
-H "Content-Type: application/json" \
-d '{
"grant_type":"client_credentials"
}'
i expected to connect, instaead the output is
{"status":{"error":true,"code":401,"type":"Unauthorized","message":"Authentication Failure"}}

IBM Watson TTS example return a blank audio file

I have some troubles with the Watson TTS example provided by IBM using cURL :
curl -X POST -u {USERNAME}:{PASSWORD} \
--header "Content-Type: application/json" \
--header "Accept: audio/wav" \
--data '{"text":"hello world"}' \
--output hello_world.wav \
"https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize"
I am running this cURL command through GitBASH but the audio file output I'm getting is blank and does not contain any audio.
I've tried changing :
--data '{"text":"hello world"}' \
to :
--data "{\"text\":\"hello world\"}" \
But I get the same result.
Remove the {} around your username and password credentials, which by the way are now compromise.
You will should revoke these credentials and create a fresh set of credentials, which you should try endevour to keep secret and not post in public forums.

Auth0 does not return user information immediately after creation

Auth0:
Sign up your user
Grep userId from response (I used jq)
Get user information by id immediately >> Returns nothing!
Repeat step 3 in 1 second >> OK
Check out this script
user=$(curl -s -X POST -d 'email=test1#mail.com&password=test1Pass&connection=Username-Password-Authentication' 'https://your-acc.auth0.com/dbconnections/signup')
userId=$(echo $user | jq -r '._id')
curl -X GET -H 'Authorization: Bearer insert-token' "https://your-acc.auth0.com/api/v2/users?q=user_id:\""$userId"\""
sleep 1
curl -X GET -H 'Authorization: Bearer insert-token' "https://your-acc.auth0.com/api/v2/users?q=user_id:\""$userId"\""
I was able to fix it by calling
/api/v2/users/{userId}
which returns single user. Surprisingly it works just fine.
Anyway, it does not solve my problem if I want to request multiple users at a time.
Did not get any response at auth0 forum.

Get image list using Orange Cloud API

Using the endpoint /folders of the Orange Cloud API, I can only get the listing of the files in the main directory:
curl -X GET -H "X-Orange-CA-ESID: OFR-2588c...2e64f249ab" -H \
"Authorization: Bearer OFR-2588c...2e64f249ab" \
https://api.orange.com/cloud/v1/folders/Lw
How could I get photos entries only, including the ones in subdirectories?
You can get all photos this way:
curl -X GET \ -H \
-H "Authorization: Bearer OFR-948ef5..." \
"https://api.orange.com/cloud/v1/folders?filter=image&flat=true"
By the way, the session header is no more necessary
https://developer.orange.com/apis/cloud-france/getting-started#filtering-on-photos,-videos,-audio-files