Verify if token not expired Github Oauth1 - php

Hey i want know if github have a endpoint to verify if a access_token have expired ?
I have tried this but i have a 404 error

404 would mean you did not authenticate properly.
Make sure to use a PAT (Personal Access Token) to authenticate your query (assuming you are not testing you own PAT itself!)
curl \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \ <==== Important
https://api.github.com/applications/Iv1.8a61f9b3a7aba766/token \
-d '{"access_token":"e72e16c7e42f292c6912e7710c838347ae178b4a"}'

Related

Display Symfony's HTTP request as a cURL request

I am trying to troubleshoot a symfony's HTTP client request. How can one display the anticipated request as a cURL request such as the following? Thank you
curl -X 'PUT' \
'https://example.com/projects/01GPX8HPBQ54SA11JKWPWFESM6/document_acl' \
-H 'accept: application/ld+json' \
-H 'Authorization: Bearer blaBlaBla' \
-H 'Content-Type: application/ld+json' \
-d '{}'

Cloudflare API - Curl request to block IP with IP Access Rules

I manually block IP to access my site (dlandroid.com) with Cloudflare "IP Access Rules",
My question is how to block an IP with Cloudflare API Curl request using PHP?
I search API document and find this but don't know how to use it with PHP:
curl -X GET "https://api.cloudflare.com/client/v4/zones/023e105f4ecef8ad9ca31a8372d0c353/firewall/access_rules/rules?page=1&per_page=20&mode=challenge&configuration.target=ip&configuration.value=198.51.100.4&notes=my note&match=all&order=mode&direction=desc" \
-H "X-Auth-Email: user#example.com" \
-H "X-Auth-Key: c2547eb745079dac9320b638f5e225cf483cc5cfdda41" \
-H "Content-Type: application/json"
also check this: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-list-access-rules

Retrieve user information from paypal in php using ios sdk

https://github.com/paypal/PayPal-iOS-SDK/blob/master/docs/profile_sharing_server.md#profile-sharing-server-side-integration
curl 'https://api.paypal.com/v1/oauth2/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Authorization: Basic QWZVa...==" \
-d 'grant_type=refresh_token&refresh_token=MFYQ...'
What is
Authorization: Basic QWZVa...== ??
and retur true;
Authorization: Basic xxxx is the OAuth 2 auth token. Basic is the token type, and the xxxx piece is your access token. It's a way of authorizing a user, and will be passed in the headers of a request. More info here: https://developer.paypal.com/docs/api/#authentication--headers

what is curl -u equivalent in php unirest

what is curl -u equivalent in php unirest
Blockscore API:
$ curl https://api.blockscore.com/people \
-u sk_test_n5049aa6053c9a0217bea78070fbf501: \
--header "Accept: application/vnd.blockscore+json;version=4"
Api key: sk_test_n5049aa6053c9a0217bea78070fbf501
I want to try this out in Unirest. but what is -u?
is it a header or a post?
The -u flag for cURL is used to set the credentials for HTTP Basic authentication. The provided credentials will be base64-encoded and presented in the "Authorization" header as in:
Authorization: Basic c2tfdGVzdF9uNTA0OWFhNjA1M2M5YTAyMTdiZWE3ODA3MGZiZjUwMTo=
So it is a header.
In unirest you should be able to use:
Unirest\Request::auth('sk_test_n5049aa6053c9a0217bea78070fbf501', '');

INTERNAL_SERVICE_ERROR when trying to verify payment via paypal REST API

I'm trying to validate a payment made through a partner service. The partner is passing me the payment id and I'm using the REST API to look it up. So far, all attempts to use the payments/payment/<Payment-Id> are throwing an INTERNAL_SERVICE_ERROR. (I'm still using the sandbox and demo user.)
Getting a token seems to be working fine:
curl -v https://api.sandbox.paypal.com/v1/oauth2/token -H "Accept: application/json" -H "Accept-Language: en_US" -u "EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp:EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp" -d "grant_type=client_credentials"
Response:
{"scope":"https://api.paypal.com/v1/developer/.* https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/vault/credit-card/.*","access_token":"A015GzttpnOSOPfcqtfAaq1kdgqow5W.IXSe6TJ9Cpbesr4","token_type":"Bearer","app_id":"APP-8KK24973T6066201W","expires_in":28800}
Taking that token and putting into the payment request:
curl -v -X GET https://api.sandbox.paypal.com/v1/payments/payment/PAY-8UD377151U702286RKOQ3DTQ -H "Content-Type:application/json" -H "Authorization: Bearer A015GzttpnOSOPfcqtfAaq1kdgqow5W.IXSe6TJ9Cpbesr4"
returns the error:
{"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error has occurred","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#INTERNAL_SERVICE_ERROR","debug_id":"ca33c7679121d"}
UPDATE: basically I'm trying to follow the steps outlined here: https://developer.paypal.com/webapps/developer/docs/integration/mobile/verify-mobile-payment/

Categories