FeathersJs authenticate returning NotAuthenticated: Invalid login - feathersjs

I am following the official guide of feathers js authenticate https://docs.feathersjs.com/guides/chat/authentication.html but it seems like even after following the guide step by step I am unable to generate tokens. Here is the body of my request to http://localhost:3030/authentication
{
"strategy": "local",
"email": "abc#foo.com",
"password": "12345678"
}
and here is the response I got
{
"name": "NotAuthenticated",
"message": "Invalid login",
"code": 401,
"className": "not-authenticated",
"data": {
"message": "Invalid login"
},
"errors": {}
}
I am using Sequilize with MySQL and I have tested my services using postman and they all are working fine (get/post data from the database)

I figured it out. It was not working because the verify method in authentication-local was verifying the password assuming that the password was hashed using their hashing utility method.
Starting the server with debug mode on have helped to figure out this issue

Related

google drive API verified domain not working with changes watch

According to https://developers.google.com/drive/api/v3/reference/changes/watch,
you need an https address to make it works if you need to watch over a change of resources.
I've configured the domain successfully by going to Google Cloud Console > Domain Verification > Add Domain.
Then I use Postman to make a call to test it:
https://www.googleapis.com/drive/v3/changes/watch?pageToken=nextPageToken
{
// "kind": "api#channel",
"id": "1234231",
"expiration": 1656402233000,
"type": "webhook",
"payload": true,
"address": "https://mrnoc.blogspot.com",
"params": {
"pageToken": "nextPageToken"
}
}
However, it failed and generated this error message:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "push.webhookUrlUnauthorized",
"message": "Unauthorized WebHook callback channel: https://mrnoc.blogspot.com"
}
],
"code": 401,
"message": "Unauthorized WebHook callback channel: https://mrnoc.blogspot.com"
}
}
I have no idea how it doesn't work, I've tried to look around but it a dead end as it seems like I've configured everything properly.
Please help if you know what might stop it from working.
Thank you

ejabberd set_preference rest api is throwing error

Can anyone please help with rest api of ejabberd's set preference
following is the request body
{
"user": "venkat",
"host": "localhost",
"resource": "tka1",
"type": "available",
"show": "away",
"status": "",
"priority": "0"
}
when I am trying to hit api i am getting response as "internal_error".
IN logs, I could see below statement
REST API Error:
set_presence([{<<"user">>,<<"venkat">>},
{<<"host">>,<<"localhost">>},
{<<"resource">>,<<"tka1">>},
{<<"type">>,<<"available">>},
{<<"show">>,<<"away">>},
{<<"status">>,<<>>},{<<"priority">>,<<"0">>}])
-> exit:{noproc,{p1_server,call,[none,
{set_presence,{presence,<<>>,available,<<>>,
{jid,<<"venkat">>,<<"localhost">>,<<"tka1">>,<<"venkat">>,<<"localhost">>,<<"tka1">>},
{jid,<<"venkat">>,<<"localhost">>,<<>>,<<"venkat">>,<<"localhost">>,<<>>},away,[],0,[],#{}}},1000]}}
[{p1_server,call,3,[{file,"src/p1_server.erl"},{line,210}]},{mod_http_api,handle2,4,[{file,"src/mod_http_api.erl"},{line,268}]},{mod_http_api,handle,4,[{file,"src/mod_http_api.erl"},{line,229}]},{mod_http_api,perform_call,4,[{file,"src/mod_http_api.erl"},{line,189}]},{mod_http_api,process,2,[{file,"src/mod_http_api.erl"},{line,142}]},{ejabberd_http,process,2,[{file,"src/ejabberd_http.erl"},{line,373}]},{ejabberd_http,process_request,1,[{file,"src/ejabberd_http.erl"},{line,496}]},{ejabberd_http,process_header,2,[{file,"src/ejabberd_http.erl"},{line,293}]}]
Using ejabberd 20.07 version
That API is used to set presence of an existing XMPP session.
In your experiment, is the account venkat#localhost logged in the server with resource "tka1"?

Google Cloud Platform can't add URI that ends with .web.app to Oauth Client ID

I have an existing client-id (Web) with some working UIDs, I added a time ago. I now wanted to add one more and when I press the save button it just does not work (ProgressIndicator is spinning infinitely). I have a working internet connection and tried with several browsers (Safari,Chrome).
Has anyone seen this?
Edit:
I just tried again with it. I got this error in the web console:
{
"error": {
"code": 400,
"message": "The request failed because one of the field of the resource is invalid.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.PreconditionFailure",
"violations": [
{
"type": "client_auth_config",
"subject": "?error_code=9&error_field_name=pending_domains&error_field_value=test-page.web.app"
}
]
}
]
}
}
When I added a domain that ended in .firebaseapp.com, everything worked. Since the domain I want to use ends in .web.app, I have a problem with this though.

Microsoft Custom Vision API: 404, Resource not found

I am trying to use Microsoft's Custom Vision API, but am running into nothing but 404 errors. How can I use the API?
I have tried copying and pasting and modifying the prediction sections of the Python and Javascript samples, such as the one found here: https://github.com/Azure-Samples/cognitive-services-node-sdk-samples/blob/master/Samples/customvision/customVisionImgClassify.js
Copying and pasting the prediction URL into my browser from the Perfomance page of Custom Vision, which is:
https://japaneast.api.cognitive.microsoft.com/customvision/v3.0/Prediction/999999999999999/classify/iterations/Iteration4/image
, yields the same 404 error:
{ "error":{ "statusCode": 404, "message": "Resource not found" }}
The closest I have gotten to successfully accessing the API is through an Azure Logic App, which uses an old version of Custom Vision:
/customvision/v1.0/Prediction/99999999999999999/image
This access method yields an "Unauthorized" error instead of a 404.
I tried modifying the JSON in the Azure Logic App to use the newer version of Custom Vision but am back to getting 404 errors. See below for the JSON (I replaced the keys and IDs with 9s):
"Predict_tags_from_image": {
"inputs": {
"body": "#triggerBody()",
"headers": {
"Content-Type": "application/octet-stream",
"Prediction-Key": "9999999999999"
},
"host": {
"connection": {
"name": "#parameters('$connections')['cognitiveservicescustomvision_1']['connectionId']"
}
},
"method": "post",
"path": "https://japaneast.api.cognitive.microsoft.com/customvision/v3.0/Prediction/9999999999999/classify/iterations/Iteration4/image"
},
"runAfter": {
"Create_file": [
"Succeeded"
]
},
"type": "ApiConnection"
}
Thank you in advance for any help with this!
I tried creating a request with the url you provided and couldn't reproduce the 404 issue. It's showing 401, as I do not have your project id or prediction key. But when I try with my own project and prediction key, everything works and it's returning 200 OK.
Could you please confirm the prediction url and prediction key header and try again?

REST API JSON error code and error message

I have been writing Web Services from a recent past, this is a sample success and error response.
error
{
"code": 1150,
"status": false,
"message": "API Student does not exist.",
"serverTime": "2013-11-29 09:47:52"
}
success
{
"code": 200,
"status": true,
"data": {
"id": 49
},
"serverTime": "2014-04-17 05:06:17"
}
With regards to returning errors I have a confusion, why do we always return one error code and one message, for example, when username and password is required as input params, say a blank request is made, so what I return is a error code 1100 and error message "Username is incorrect". I never return the whole list of errors, for example, in this case, two error message with two error codes should be sent so it saves end users data & time.
This is a sample of what I suggest?
{
"code": 1010,
"status": false,
"errors": [
{
"code": 1000,
"name": "Username invalid"
},
{
"code": 1001,
"name": "Password invalid"
},
{
"code": 1002,
"name": "Password not strong"
}
],
"serverTime": "2013-12-03 12:34:02"
}
Why is this not a good way to do? I have not seen this in either Twitter API or Facebook API.
Nobody can stop API designers to return multiple possible error responses. Decision is up to them only but in my opinion you should return most relevant error occurred from server side.
There can be many reasons behind it like below :
Unified Error Handling by all clients.
Most relevant error caused will help client more actually as he will not have to take care about all probabilistic error caused.
JSON structure simplicity. ( Error Array will be avoided. )