I know that I can use the feathers JavaScript client lib to retrieve a security token. But I would like to use C# fronted to connect to a feathersjs backend. Is it possible to retrieve the security token using a simple rest call. I know that there is a /auth/local endpoint, but I have no idea how to use it directly.
This should work from console:
curl -X POST 'http://localhost:3030/auth/local' -H 'Content-Type: application/json' --data-binary '{ "email": "<EMAIL>", "password": "<PASSWORD>" }'
One thing that's not very clear in feathersJS documentation is that the configs in default.json/production.json files actually create auth services for each field in the "auth" object. For example with config containing
"auth": {
"idField": "id",
"token": {
"secret": {...},
"local": {},
"facebook": {
"clientID": "...",
"clientSecret": "...",
"profileFields": ["id", "name", "gender", "email", "picture.type(square).height(128).width(128)"],
"permissions": {
"scope": ["public_profile","email"]
}
},
"google": {
"clientID": "]...",
"clientSecret": "...",
"permissions": {
"scope": ["profile"]
}
}
}
You will get for free API endpoints
/auth/local
/auth/token
/auth/facebook/token
/auth/google/token
which you can call from any client (web, mobile, washing mashine)
Ok, I have to post the Json object containing email, password and type local to the the /auth/local endpoint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With