Getting a user's Paypal subscription details - paypal-rest-sdk

I would like people to be able to subscribe to my website through Paypal. I've managed to install the Paypal buttons and can now obtain an access token to make "REST API" calls. But I'm failing to get any details of the subscriptions. Here's my cURL code which I run through reqbin.com:
curl -v -X GET https://api-m.paypal.com/v1/payments/billing-plans?page_size=3&status=ALL&page_size=2&page=1&total_required=yes \
-H "Content-Type: application/json" \
-H "Authorization: Bearer A21AAOtUj14g7QOd..............mL2MjJrgPE-Hr5lkaBN4f5Tg8wiErwgWd-sn-1hg6yqRMjtgRg"
curl -v -X GET https://api-m.paypal.com/v1/payments/billing-plans/P-8YD8773..........5UOKQ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer A21AAOtUj14g7QOdj2PKN............6nutDPKmL2MjJrgPE-Hr5lkaBN4f5Tg8wiErwgWd-sn-1hg6yqRMjtgRg"
where you can see I have inserted the details of my access token and my billing plan ID obtained from my Paypal account. The former curl call should return details of my billing plan ID and the latter subscriptions under it. But the billing plan doesn't seem to exist as far as the API-REST goes. Can anyone see what I'm doing wrong?
Thanks.

It seems you are using a deprecated billing-plans API.
The current PayPal Subscriptions APIs are documented here., with a guide here.

Related

CURL Rest API via Proxy

I want to get data from ServiceNow via a CURL in Putty via a Proxyserver (Plan is to implement it to a PySpark script later on) and then save the data onto the server.
My Command looks like this:
curl -x <proxyadress:port> -U proxyuser:proxypassword -u '<apiuser:apipassword>' -d status="message" "https:/apiadress" -H 'Accept: application/json'
I get the error message:
{"error":{"message":"Invalid content-type. Supported request media types for this service are: [application/json, application/xml, text/xml]","detail":null},"status":"failure"}
A few days ago I was able to have the data printed into the log but didn't manage to replicate the command ... what's wrong?
Thanks for your help

How to change Loopback accessToken from queryString to Bearer Token

I'm working on using Loopback to create a mock service. I need this mock service to authenticate using Bearer Tokens. Something like this:
curl -X GET --header 'Accept: application/json' --header 'Authorization: BEARER ABCDEFG' 'http://localhost:3000/api/Puppies'
At the moment, authentication is handled out of the box using a query string like this:
curl -X GET --header 'Accept: application/json' 'http://localhost:3000/api/Puppies?access_token=ABCDEFG'
Is there a way I can change the default authentication to the former?
In order to authenticate using Bearer tokens, you can use Loopback #loopback/authentication package. If you want to use JWT, you need #loopback/authentication-jwt extension.

dialogflow nodejs client showing no security token sent error

I am trying to integrate my Dialogflow agent with Skype. I follow this link https://github.com/dialogflow/dialogflow-nodejs-client/tree/master/samples/skype to customize my bot responses. The webhook is deployed on Heroku. The issue is that I am getting this error "error: chatconnector: receive - no security token sent" always. The below CURL request looks fine
curl -X POST \
https://login.microsoftonline.com/botframework.com/oauth2/v2.0/token \
-H 'cache-control: no-cache' \
-H 'content-type: application/x-www-form-urlencoded' \
-H 'postman-token: 2774cb69-14bb-7247-d3bb-7bdda2de0e4c' \
-d 'grant_type=client_credentials&client_id=f6f66a29-f184-48a0-9913-bda96c22be4f&client_secret=bkVCGV20*%25%2BfoicfITP333%40&scope=https%3A%2F%2Fapi.botframework.com%2F.default'
You can test this code and it clearly says there is no issue with Microsoft API regarding authentication. I am really stuck with this. Please help me in solving this.

Azure CLI Create AD App with AllowImplicit

Is there any way that I can create or modify an AzureAD App to allow the OAuth 2.0 Implicit flow via the Azure CLI 2.0?
I'm able to create app registrations without issue using az ad app create
It does not look like the Azure CLI 2.0 exposes the OAuth2AllowImplicitFlow property to be set, however the Azure Active Directory PowerShell 2.0 does expose this property:
-Oauth2AllowImplicitFlow
Specifies whether this web application can request OAuth2.0 implicit
flow tokens. The default is false.
Type: Boolean
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Let me know if this helps.
You can use CLI to call Graph API to do achieve that. This method needs to create service principal in your AAD Tenant, and assign Company Admin role to it.
Get an authentication token
curl -X "POST" "https://login.microsoftonline.com/$TENANTID/oauth2/token" \
-H "Cookie: flight-uxoptin=true; stsservicecookie=ests; x-ms-gateway-slice=productionb; stsservicecookie=ests" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=$APPID" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "client_secret=$PASSWORD" \
--data-urlencode "resource=https://graph.windows.net/"
Set the AAD applicaiton Oauth2AllowImplicitFlow to be true:
curl -X "PATCH" "https://graph.windows.net/$TENANTID/applications/$ObjectId?api-version=1.6" \
-H "Authorization: Bearer $ACCESSTOKEN" \
-H "Content-Type: application/json" \
-d $'{"oauth2AllowImplicitFlow":true}'
After few seconds, Oauth2AllowImplicitFlow of your application has been set to be true.
Additional, as #Shawn said that Azure CLI doesn't have this cmdlet to set AAD Application,but Azure Powershell have. However Azure CLI is an important tool for Linux platform to use Azure. I think we can post this feature feedback in this Page. Azure Team will review it.
Hope this helps!

Spring Boot: Full authentication is required to access this resource

I am doing example of Spring Boot Security with wso2is server from this post https://github.com/angel-git/wso2is-springoauth, when I am trying to access resource with access token I am getting
{"error":"unauthorized","error_description":"Full authentication is required to access this resource"}
I am generating access token by:
curl -u CLIENT_ID:CLIENT_SECRET-k -d
"grant_type=password&username=admin&password=admin" -H
"Content-Type:application/x-www-form-urlencoded"
https://localhost:9443/oauth2/token
and accessing resources by:
curl -H GET "Authorization: ACCESS_TOKEN"
http://localhost:8080/greeting
I found many solution on stackoverflow but unfortunately could not solve my issue
please help, thank you
I was getting the same error message for
"curl http://localhost:8080/spring4/beans" :
{"timestamp":1493591079040,"status":401,"error":"Unauthorized","message":"Full authentication is required to access this resource.","path":"/spring4/beans"}
Setting the below property in application.properties bypassed the security check & I could use all the acuator endpoints:
management.security.enabled=false
Many thanx to Angel Gavalda who helped me to solved problem. I used following commands to generate access token and access resource
For Generating Access token:-
curl -k -d
'grant_type=client_credentials&client_id=yourClientId&client_secret=yourClientSecret'
https://localhost:9443/oauth2/token
For Accessing Resource:-
curl -k -H "Authorization: Bearer $ACCESS_TOKEN"
http://localhost:8080/greeting
When the answer above does not solve this issue change OAuthConfigurations/RemoveOAuthHeadersFromOutMessage to false in the file api-manager.xml.

Resources