Gocardless - Redirect flow in Node JS - node.js

I'm trying to use Gocardless to enable SEPA payment in my website.
The example in the API doc doesn't work and seems uncomplete
POST https://api.gocardless.com/redirect_flows HTTP/1.1
{
"redirect_flows": {
"description": "Wine boxes",
"session_token": "SESS_wSs0uGYMISxzqOBq",
"success_redirect_url": "https://example.com/pay/confirm",
"prefilled_customer": {
"given_name": "Frank",
"family_name": "Osborne",
"email": "frank.osborne#acmeplc.com"
}
}
}

That's the response I get :
{
"error": {
"message": "not found",
"errors": [
{
"reason": "not_found",
"message": "not found"
}
],
"documentation_url": "https://developer.gocardless.com/api-reference#not_found",
"type": "invalid_api_usage",
"request_id": "7ae43821-345d-4ffd-98d6-15c4fe5513e6",
"code": 404
}
}
How can it work if the access token of the application is never asked for the request ?

Related

Google Cloud VM request is missing authentication credential

I recently deployed a Node.js/express application to a Google Cloud Compute VM. How do I send it get requests? I followed the instructions in this article to get my URL. When I curl it from the command line, though, I get a 401 authentication credential error.
Request:
https://compute.googleapis.com/compute/v1/projects/*PROJECT_ID*/zones/*ZONE*/machineTypes/e2-standard-2
I am already logged into the gcloud SDK--is there some kind of other auth I need to network with my VM?
Full Error Message:
{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"errors": [
{
"message": "Login Required.",
"domain": "global",
"reason": "required",
"location": "Authorization",
"locationType": "header"
}
],
"status": "UNAUTHENTICATED",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"method": "compute.v1.MachineTypesService.Get",
"service": "compute.googleapis.com"
}
}
]
}
}

Sharepoint online GraphAPI create list with invalid request

I am trying to create a list with in a site using the graph API.
URL: https://graph.microsoft.com/v1.0/sites/{tenantsharepoint.com}:/sites/{siteName}:/lists
Request Body:
{
"displayName": "Books",
"columns": [
{
"name": "Author",
"text": { }
},
{
"name": "PageCount",
"number": { }
}
],
"list": {
"template": "genericList"
}
}
It was working fine but all of sudden it started giving me below exception:
{
"error": {
"code": "invalidRequest",
"message": "Provided identifier is malformed - site collection id is not valid",
"innerError": {
"date": "2020-07-31T05:28:46",
"request-id": "302c5ee3-3799-4a24-a2a3-185d7801f78a"
}
}
}
Any pointers leads would be appreciated.

Loopback error without strong-error-handler

If I have strong-error-handler in my middleware.json (i.e "final": { "strong-error-handler": {} }) then the error response structure looks like this:
{
"error": {
"statusCode": 500,
"message": "Your Error Message",
"code": "123"
}
}
But when I remove strong-error-handler from middleware.json, then the error structure looks like this:
{
"errors": [
{
"status": 500,
"source": {},
"title": "Error",
"code": "123",
"detail": "Your Error Message"
}
]
}
I can't seem to figure out how/where that error body is made when I'm not using strong-error-handler. Is there a default?
Figured it out!! Turns out it was using the errorHandler from loopback-component-jsonapi node module.

Gmail API: Cannot create filters via Google APIs Explorer

I am trying to create filters via the Gmail API
Services > Gmail API v1 > gmail.users.settings.filters.create
Listing and lookup of single filters are working but I am not able to create new filters.
Request
POST https://www.googleapis.com/gmail/v1/users/me/settings/filters?key={YOUR_API_KEY}
{
"criteria": {
"query": "test"
},
"action": {
"addLabelIds": [
"Label_582"
]
}
}
Response
500
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "backendError",
"message": "Backend Error"
}
],
"code": 500,
"message": "Backend Error"
}
}
"Label_582" is valid.
Any ideas?
Thanks and best regards

Ionic Push Notification on database Insertion

Deal All,
I am working on Ionic2 which receives push notifications. It is working fine. I want to fo a step further. I need to automate the push notifications. I am using PHP with mySQL. I also have NodeJS WebApi. Is there any possibility in NodeJS or PHP to send Ionic Push notification? I have followed the following tutorial in NodeJS but I get 401 Unauthorized error:
ionic-push-server
Following is the error:
STATUS: 401
HEADERS: {"date":"Thu, 13 Apr 2017 19:13:09 GMT","content-type":"application/json; charset=utf-8","content-length":"196","connection":"close","server":"openresty","via":"1.1 vegur","access-control-allow-credentials":"true","access-control-allow-methods":"HEAD,GET,POST,PATCH,PUT,DELETE,OPTIONS","access-control-allow-headers":"DNT,Authorization,X-CSRFToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type"}
BODY: {"meta": {"version": "2.0.0-beta.0", "status": 401, "request_id": "00000000-1111-2222-3333-444444444444"}, "error": {"link": null, "type": "Unauthorized", "message": "JWT decode error occurred."}}
var ionicPushServer = require('ionic-push-server');
var credentials = {
IonicApplicationID : "IonicAppId",
IonicApplicationAPItoken : "IonicApplicationAPIToken" //You need to generate from app settings
};
var notification = {
"tokens": ["your", "device", "tokens"],
"profile": "AppProfileNameInSmallLetters",
"send_to_all": true,
"notification": {
"title": "Hi",
"message": "Hello world!",
"android": {
"title": "Hey",
"message": "Hello Android!",
"payload": {
"category": "Star"
}
},
"ios": {
"title": "Howdy",
"message": "Hello iOS!",
"payload": {
"category": "Star"
}
}
}
};
ionicPushServer(credentials, notification);

Resources