I have tried to use Django basic Authentication feature to verify username(test) and password(test).
It works from my local:
curl -H 'Accept: application/json; indent=4' -u test:test 'http://127.0.0.1:8000/api/checkuser/'
{
"detail": "Account authorized."
}
But it failed from production site:
curl -H 'Accept: application/json; indent=4' -u test:test 'https://production.fake/api/checkuser/'
{
"detail": "Authentication credentials were not provided."
}
I have tried to enable WSGIPassAuthorization from production server, but it does not help.
It seems to me that somehow the username and password did not really pass through, but cannot figure out how.
It works if I use web browser to access https://production.fake/api/checkuser/
Any advice to troubleshoot will be really appreciated. Thanks!
Related
I am probably just missing something here.
I can successfully call cloud code functions on my AWS elastic beanstalk deployment (e.g. /parse/functions/abc), but saving a class directly via PUT always times out.
Locally on my dev server everything works like a charm.
This is a sample call:
curl -X "PUT" "http://<redacted>.elasticbeanstalk.com/parse/classes/Test/tFSSqF5w4f" \
-H 'x-parse-session-token: <redacted>' \
-H 'x-parse-application-id: <redacted>' \
-H 'x-parse-client-key: <redacted>' \
-H 'x-parse-os-version: 14.1 (16C50)' \
-H 'Content-Type: text/plain; charset=utf-8' \
-d $'{
"r_instruments": [
"violin",
"singer"
]
}'
In the EB server logs I found the following error, but I don't know how to fix it (especially since calling a cloud code function works like a charm).
2022/04/03 21:43:12 [error] 5122#5122: *1 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 24.164.138.198, server: , request: "PUT /parse/classes/Test/tFSSqF5w4f HTTP/1.1", upstream: "http://127.0.0.1:8080/parse/classes/Test/tFSSqF5w4f", host: "<redacted>.elasticbeanstalk.com"
Did anybody else ran into this problem by any chance?
I am totally lost here.
I am using WSO2 IOT server, RaspberryPi 3 device with LED and DTH11 sensor. I can manage LED with console.
What I am trying to do is turn it On and Off with my mobile application. So, I want to know how can I send the HTTP request to the API and the request also. The server is running in localhost. Can anyone help me?
This is the command I used:
curl -k -X POST https://172.16.13.86:8243/api/device-mgt/v1.0/devices/raspberrypi/operations
-H 'accept: application/json' -H 'authorization: Bearer a7a156d7-0393-3350-8b9b-0ac956723440'
-H 'content-type: application/json' -d '{"deviceIdentifiers":[r1lovwmwg113],
"operation":{"code":"bulb","type":"CONFIG", "payLoad":"state:ON"}}'```
And this is the reply:
{"activityId":"ACTIVITY_36492","code":"bulb","type":"CONFIG","createdTimeStamp":"Fri
Dec 21 11:38:20 IST
2018","activityStatus":[{"deviceIdentifier":{"id":"r1lovwmwg113","type":"raspberrypi"},"status":"PENDING"}]}
I'm trying to access on my Django API using curl from my local terminal to a VSP
curl -H 'Accept: application/json; indent=4' -u admin:password http://127.0.0.1:8000/users/
So, I tried many things like,
replace admin:password to my actual vps root#password
replace admin:password to my actual database admin#password
replace http://127.0.0.1:8000 to my vps url
replace the port 8000 by 22, or 80, 8080
And by the way, I don't know is I have to change /users/ by /root/ or anything else.
I have tried many mix and nothing works.
Here what I'm testing : http://www.django-rest-framework.org/tutorial/quickstart/#testing-our-api
If important, my vps machine is Debian 9 (Stretch)
Think you for your help
This worked for me:
curl -H 'Accept: applicatin/json; indent=4' -u [superuser username]:[superuser password] http://YOURVPSIPADDRESS/users/
The admin:password should be the superuser username and password on your Django site not the username or password for your database or VPS. Ensure a superuser has been created for your Django site on your VPS.
I have followed the instructions from https://github.com/spring-cloud-services-samples/cook and managed to install and run Config Server in PCF environment (SERVICE: Config Server, PLAN: standard).
I'm now trying to hit /encrypt endpoint of the p-config-server service, in order to encrypt new value. I'm following the instructions at http://docs.run.pivotal.io/spring-cloud-services/config-server/configuring-with-git.html#encryption-and-encrypted-values:
TOKEN=$(curl -k ACCESS_TOKEN_URI -u CLIENT_ID:CLIENT_SECRET -d
grant_type=client_credentials | jq -r .access_token); curl -k -H
"Authorization: bearer $TOKEN" -H "Accept: application/json"
URI/encrypt -d 'VALUE'
...but I always get:
{
"error": "access_denied",
"error_description": "Access is denied"
}
On the other side, if I try to get standard endpoint, to get config for an app, I'm able to retrieve JSON containing app properties. E.g.
TOKEN=$(curl -k ACCESS_TOKEN_URI -u CLIENT_ID:CLIENT_SECRET -d
grant_type=client_credentials | jq -r .access_token); curl -k -H
"Authorization: bearer $TOKEN" -H "Accept: application/json"
URI/my-app/default
... gives result like:
{"name":"my-app","profiles":["default"],"label":null,"version":"bb6e64592ced731ebba272430291a595e0f14a77","state":null,"propertySources":[{"name":"https://github.com/some-user/config/my-app.yml","source":{"my-property.name":"Test123"}}]}
Any idea why I can not access /encrypt endpoint?
Thank you.
Btw, I'm executing the command in CentOS Linux release 7.4.1708, with installed jq (command-line JSON processor).
I've got the answer from CloundFoundry IT support. In my CF environment, "encrypt" endpoint should have a trailing slash (/). So it should be ...URI/encrypt/ -d 'VALUE'. Maybe it helps someone.
One more hint I've got: There is a CF CLI plugin for the Spring-Cloud-Services which you could use for convenience.
https://github.com/pivotal-cf/spring-cloud-services-cli-plugin
cf install-plugin -r CF-Community "Spring Cloud Services"
cf help config-server-encrypt-value
Hi Actually you need to hit cf env command first and take note of configuration values from that which for sample looks like below:
{
"VCAP_SERVICES": {
"p-config-server": [
{
"credentials": {
"access_token_uri": "https://p-spring-cloud-services.uaa.cf.wise.com/oauth/token",
"client_id": "p-config-server-876cd13b-1564-4a9a-9d44-c7c8a6257b73",
"client_secret": "rU7dMUw6bQjR",
"uri": "https://config-86b38ce0-eed8-4c01-adb4-1a651a6178e2.apps.wise.com"
},
[...]
and then use those values in your curl bash script. for example
TOKEN=$(curl -k https://config-86b38ce0-eed8-4c01-adb4-1a651a6178e2.apps.wise.com -u p-config-server-876cd13b-1564-4a9a-9d44-c7c8a6257b73:rU7dMUw6bQjR -d
grant_type=client_credentials | jq -r .access_token); curl -k -H
"Authorization: bearer $TOKEN" -H "Accept: application/json"
URI/ENDPOINT | jq
Basically following values are required:
ACCESS_TOKEN_URI with the value of credentials.access_token_uri
CLIENT_ID with the value of credentials.client_id
CLIENT_SECRET with the value of credentials.client_secret
URI with the value of credentials.uri
Replace ENDPOINT with the relevant endpoint:
application/profile to retrieve configuration from a Config Server service instance
eureka/apps to retrieve the registry from a Service Registry service instance
Then I think you will no more get access denied response.
I am trying to register my app with FB Realtime Graph updates and having issues with FB verifying my callback URL. I can successfully register (and receive updates) with FB using HTTP but I need to switch to HTTPS.
curl -XPOST -i -v \
-d 'access_token=$OAUTH_TOKEN' \
-H 'Accept: application/json' -H 'Content-Type: application/json' \
-d "object=user" -d "fields=friends,name" -d "callback_url=https://$MY_RUL" \
-d "verify_token=$VERIFY_TOKEN" "https://graph.facebook.com/$APP_ID/subscriptions"
and yes, I am using the correct values in all $ variables.
I receive an HTTP 400 Bad Request with body:
{"error":{"message":"(#2200) callback verification failed: SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed","type":"OAuthException"}}
But I do have SSL setup correctly, as far as I can tell. I can issue other CURL calls against my HTTPS endpoint.
$ curl -i https://foo.com/health
HTTP/1.1 200 OK
Content-Type: text/plain
Date: Mon, 17 Oct 2011 19:56:42 GMT
Status: 200
X-Rack-Cache: miss
X-Runtime: 0.002040
Content-Length: 21
Connection: keep-alive
pong
Where is the issue, is it on my end or facebooks?
Note: I see similar issues here on SO especially in regards to Ruby / HTTPS, such as:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
But I dont think this is my issue, and again, I am attempting to us CURL directly to ensure its not a Ruby/OpenSSL issue.
Plus, since FB says callback verification failed it makes me think the error is on FBs end when it is verifying MY callback URL.
Any help would be appreciated.
We don't have your parent certificate in our CA chain since its relatively new. You'll need to include all of the parent certificates in the chain. I'm guessing the step got skipped during install.
See the concatenate step on https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&id=SO17664