fake-api-jwt-json-server | Fake API with JWT Authentication using json | Authentication library
kandi X-RAY | fake-api-jwt-json-server Summary
kandi X-RAY | fake-api-jwt-json-server Summary
A Fake API with JWT Authentication using json-server and jsonwebtoken
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Checks if email is logged in
- Create a jwt token .
- Verifies a token
fake-api-jwt-json-server Key Features
fake-api-jwt-json-server Examples and Code Snippets
Community Discussions
Trending Discussions on fake-api-jwt-json-server
QUESTION
I set up a fake json server (fake-api-jwt-json-server) taken from GitHub on my PC. Using url http://localhost:8000/auth/login, I am able to post to it successfully from Postman but when I tried from Visual Studio 2019, I got the error 'No connection could be made because the target machine actively refused it' (see error detail below). The same was the result when I tried another fake json server. In both cases, the url included 'http://localhost'. From VS, I am able to get responses from api endpoints that do not include 'http://localhost' with no problem. Why are the localhost api urls not working when I try them from VS? I have tried switching off my firewall.
The error message:-
jServerAGetAccessToken Source: Tests.cs line 27 Duration: 2.1 sec
Message:
System.AggregateException : One or more errors occurred. (No connection could be made because the target machine actively refused it.)
----> System.Net.Http.HttpRequestException : No connection could be made because the target machine actively refused it.
----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it.
Stack Trace:
Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
Task1.GetResultCore(Boolean waitCompletionNotification) Task
1.get_Result()
Tests.jServerAGetAccessToken() line 50
--HttpRequestException
ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean allowHttp2, CancellationToken cancellationToken)
HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
HttpConnectionPool.GetHttpConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
HttpClient.FinishSendAsyncBuffered(Task1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts) HttpMethods.PostWithKey(Dictionary
2 url, StringContent postParamaters) line 92
--SocketException
ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
And now my code:-
...ANSWER
Answered 2021-Jan-17 at 18:16Try changing the endpoint (base) address to include also the port to http://127.0.0.1:8000
:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fake-api-jwt-json-server
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page