How can I retrieve Tinder API authentication? - bash

$ curl -X POST
-H "X-Auth-Token: FB_AUTH_TOKEN" \
-H "Content-type: application/json" \
-H "User-agent: Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)" \
https://api.gotinder.com/auth
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 69 100 69 0 0 105 0 --:--:-- --:--:-- --:--:-- 105{"code":400,"error":"Missing authToken#NO_FB_TOKEN","error_no":40001}
Does this mean I go thet incorrect Facebook auth token? I'm following the specifications in this REST API: https://github.com/fbessez/Tinder

Based on the documentation you referred, I can see you are not sending the post data in the request body {'facebook_token': INSERT_HERE, 'facebook_id': INSERT_HERE}
Besides, the docs says X-Auth-Token is not required for /auth

This appears to have been changed as per: https://github.com/fbessez/Tinder/issues/69
Now the request is
curl --location --request POST 'https://api.gotinder.com/v2/auth/login/facebook' \
--header 'platform: ios' \
--header 'User-agent: Tinder/7.5.3 (iPhone; iOS 10.3.2; Scale/2.00)' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"token": "{{facebook_token}}",
"facebook_id": "{{facebook_id}}"
}'
The changes are:
the URL endpoint
Payload key: 'facebook_token' is now just 'token'

Related

Passing array of values in Sinatra GET in a less verbose way

I know Sinatra is not super concise when it comes to this topic. To pass an array of values to a GET controller through query string I'd have to do:
curl -v -H 'ContentType: application/json' -H 'Accept: application/json' 'http://0.0.0.0:8848/my/test?param1[]=1&param1[]=2&param1[]=3'
isn't there a way to do something like:
curl -v -H 'ContentType: application/json' -H 'Accept: application/json' 'http://0.0.0.0:8848/my/test?param1[]=1,2,3'
without then having to split/manipulate the string to get the different values?
You can use one of the usual gem for sinatra: https://github.com/mattt/sinatra-param.
curl -v \
-H 'ContentType: application/json' \
-H 'Accept: application/json' \
'http://0.0.0.0:8848/my/test?param1=1,2,3'
get '/test' do
param :param1, Array
end

Automate cURL to run through a list of ID's

I am attempting to run through a list of 10 contact ID's every ten minutes with cURL
This is the code I am trying to run
curl --request POST \
--url https://youraccountname.api-us1.com/api/3/contactAutomations \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'api-token: test' \
--data '
{
"contactAutomation": {
"contact": THE VARIABLE,
"automation": 23
}
}'
The list of contact variables could just be line items in a text file.
Is this something a bash script with cron could handle - and it just deleted the 10 IDs it runs?
Or is this something I would need to use python and a database to run?
This is really a one off thing - so a cron with a script would be easiest since it doesn't need to be used more than one time through.
If you have a constant list of IDs:
for id in 123 456 555 777
do
curl --request POST \
--url https://youraccountname.api-us1.com/api/3/contactAutomations \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'api-token: test' \
--data "
{
\"contactAutomation\": {
\"contact\": $id,
\"automation\": 23
}
}"
done

Curl method with authentification problem

I have a little problem with my bearer:
I have a config file with my variable bearer like this:
bearer = "*********"
And I have my script test.sh :
source /home/name/test/config
curl -X GET \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer $bearer' \https://.../api/vendors \-o
json_file/vendors.json
And then when I open my file vendors.json. It say token invalid or was expired and normaly my token is good, I'm sure. So Where is my problem ?
Thanks

curl: 400 Bad Request. The browser (or proxy) sent a request that this server could not understand

I'm getting "400 Bad Request. The browser (or proxy) sent a request that this server could not understand." for the curl command. Curl command is as below, can someone please help?
token=jfkdjfdikdjydve83hhd54rsfdghsghktwhdh87
payload_file=test_fortify_scan.zip
curl -X POST https://dnsname/api/scan \
-H "authorization: Bearer $token" \
-H 'content-type: application/json' \
-d '{"projVer": "dev", "language": "java",
"payloadFile":"$payload_file", "emailList": "myemail#mail.com"}'
Looks like quotes problem. Look at Using curl POST with variables defined in bash script functions
token="jfkdjfdikdjydve83hhd54rsfdghsghktwhdh87"
payload_file="test_fortify_scan.zip"
curl -X POST https://dnsname/api/scan \
-H "authorization: Bearer $token" \
-H 'content-type: application/json' \
-d '{"projVer": "dev", "language": "java",
"payloadFile":"'"$payload_file"'", "emailList": "myemail#mail.com"}'

rest api openam add user parametrised

hello I have this script in bash:
first part : authentication against server - works fine.
second part: adds user - and this works fine when I define user directly in curl code - but when I want to add user from parameters.. then I got a message error:
"{"code":400,"reason":"Bad Request","message":"The request could not
be processed because the provided content is not valid
JSON","detail":"Unexpected character ('$' (code 36)): expected a valid
value (number, String, array, object, 'true', 'false' or 'null')\n at
[Source: org.apache.catalina.connector.CoyoteInputStream#3a248e6a;
line: 2, column: 18]"}"
Any ideas how can I pass values to this script ? :)
Regards
#!/bin/bash
adm_user="admin"
adm_pass="secret"
user_name=""
user_pass=""
auth_url="http://url/OpenAM-11.0.0/json/authenticate"
add_user_url="http://url/OpenAM-11.0.0/json/users/?_action=create"
session_id=$(curl \
--request POST --header "X-OpenAM-Username: $adm_user " \
--header "X-OpenAM-Password: $adm_pass" \
--header "Content-Type: application/json" \
--data "{}" $auth_url | cut -d"\"" -f4 )
sleep 1
curl \
--request POST \
--header "iplanetDirectoryPro: $session_id" \
--header "Content-Type: application/json" \
--data \
'{
"username": "$1",
"userpassword": "secret12",
"mail": "bjensen#example.com"
}' \
$add_user_url
OK, mates I got the answer:
'{
"username": "'"$1"'",
"userpassword": "'"$2"'" ,
"mail": "bjensen#example.com"
}' \

Resources