A simple test http server that you can use to simulate a real-lie auth token service for Stream Chat.
The http server will randomly make fail such as returning errors, invalid tokens or already expired tokens.
- Clone this repo
- Make sure you have a recent Golang compiler installed
- Run the HTTP server
go run main.go -secret STREAM_API_KEY
This will run an HTTP server on :8090 and return a JSON response with a token for request on the /token
path
curl http://localhost:8090/token?userID=jack
By default, the server will pick a random outcome from this list:
serverTimesOut
server replies with empty body after 1 hourserverErrors
server errors with a 500 HTTP errorreturnsExpiredToken
server returns a valid token but with theexp
claim in the pastreturnsValidToken
server returns a valid token with 60s expirationreturnsGarbageToken
server returns a valid JWT token but with invalid claims
You can pick different outcomes when you start the server:
// will only return 500 errors and timeouts
go run main.go -secret STREAM_API_KEY -outcomes serverErrors,serverTimesOut