Comments (25)
@elv1n @LaoTsing @befeltingu @Mijobar
So the issue is that the secret key you are supplying as an environment variable to your server is not 32 characters long.
I have updated the example secret in the Readme to be the correct length.
I also updated the code so that you will see a "KeySizeTooSmall" error if the server is given too short a secret. Then this invalid secret is then used to sign a JWT when user registers. Of course this doesn't work and you get a 401.
Does using a 32 character long key for the secret fix your 401 issue?
from poker-maison.
You need to add more characters to the key used to signing auth tokens.
This key is obtained from an environment variable called "secret" by the app.
secret=mysecretkey stack run
from poker-maison.
oh thank you very much
from poker-maison.
No problem just let me know if you have any other issues and I will help.
from poker-maison.
from poker-maison.
now registration not working
from poker-maison.
Are you trying to reregister an account which already exists?
Try logging in.
from poker-maison.
no no, registration not working, new user do not added
from poker-maison.
why login only from localhost, i try connect to my localhost from ngrok - and request not sended ??? can you try connect throw ngrok?
from poker-maison.
So when you register you get a 401 and the user isn't inserted into the DB?
from poker-maison.
So when you register you get a 401 and the user isn't inserted into the DB?
Yes it is
from poker-maison.
and how to add bots to game?
from poker-maison.
So when you register you get a 401 and the user isn't inserted into the DB?
Yes it is
i found and fix problem with registration
from poker-maison.
So what was causing the problem?
from poker-maison.
a problem is a not correct setting urls in profile... and how to add bots to game? and redis do not used?
from poker-maison.
Also having the same issue... Why I click register is doesn't do anything my guess is it's not saving to redis server?
michael@michael-HP-Pro3500-Series:~/Desktop/ten-poker-master/server$ stack run
"couldn't parse redishost from env default used"
"REDIS config: "
ConnInfo {connectHost = "localhost", connectPort = PortNumber 6379, connectAuth = Nothing, connectDatabase = 0, connectMaxConnections = 50, connectMaxIdleTime = 30s, connectTimeout = Nothing, connectTLSParams = Nothing}
from poker-maison.
yes this is is write in log
from poker-maison.
@LaoTsing is the default redis ConnInfo good? If no, can you give me an example and where i need to put it? Thanks!
from poker-maison.
@Mijobar The default redis ConnInfo is good if you are running redis on localhost on port 6379.
These are the default settings redis uses when you run redis-server
.
If you for some reason need to change the defaults the app uses then you would start by looking here as this where the default configuration is set.
from poker-maison.
@therewillbecode why redis not used automatically?
from poker-maison.
@LaoTsing is the default redis ConnInfo good? If no, can you give me an example and where i need to put it? Thanks!
if you used redis say me how)
from poker-maison.
@therewillbecode Really awesome project!
I am having a similar issue it seems. I am not too familiar with the redis / postgres workflow so it is probably something small. Similar to Lao when I create a user I get a 401 but the user gets created I can see in the postgres db. I also get a 401 when trying to login with that user I just created.
This the key I am using
secret="tenpokersupersecretkey123"
I am not sure how to debug this. Any suggestions?
It seems like maybe it didnt like the password I provided because the password I used to register is ignored and a random one is set in the db. Unless it is just storing the password safely.
from poker-maison.
So what was causing the problem?
I have got the same problem, the user saves into DB but then cannot authorize it.
Redis is on 6379 and responding for 'redis-cli ping'
❯ stack run
"Redis host name from env is: "
"127.0.0.1"
"REDIS config: "
ConnInfo {connectHost = "127.0.0.1", connectPort = PortNumber 6379, connectAuth = Nothing, connectDatabase = 0, connectMaxConnections = 50, connectMaxIdleTime = 30s, connectTimeout = Nothing, connectTLSParams = Nothing}
[Debug#SQL] SELECT "id", "name" FROM "tables" WHERE ("name"=?) LIMIT 1; [PersistText "Black"]
[Debug#SQL] SELECT "id", "name" FROM "tables" WHERE ("name"=?) LIMIT 1; [PersistText "Black"]
[Debug#SQL] UPDATE "users" SET "available_chips"=? WHERE ("available_chips"<?); [PersistInt64 200000,PersistInt64 200000]
"Socket server listening on 5000"
OPTIONS /register
Accept: */*
Status: 200 OK 0.000024s
[Debug#SQL] SELECT "id", "username", "email", "password", "available_chips", "chips_in_play", "created_at" FROM "users" WHERE ("email"=?) LIMIT 1; [PersistText "test@testcom"]
[Debug#SQL] SELECT "id", "username", "email", "password", "available_chips", "chips_in_play", "created_at" FROM "users" WHERE ("username"=?) LIMIT 1; [PersistText "elvin3"]
[Debug#SQL] INSERT INTO "users"("username","email","password","available_chips","chips_in_play","created_at") VALUES(?,?,?,?,?,?) RETURNING "id"; [PersistText "test",PersistText "test@elvintestcom",PersistText "\154\180\210\STXAr\200FoXB\241l\"\185EbfAkq\ETX\DC1\189\140Z\148\199\159#1\187",PersistInt64 3000,PersistInt64 0,PersistUTCTime 2020-04-15 19:02:51.917578 UTC]
POST /register
Request Body: {"newUsername":"test","newUserEmail":"[email protected]","newUserPassword":"test"}
Accept: application/json, text/plain, */*
Status: 401 Unauthorized 0.020263s
[Debug#SQL] UPDATE "users" SET "available_chips"=? WHERE ("available_chips"<?); [PersistInt64 200000,PersistInt64 200000]
from poker-maison.
Also having the same issue... Why I click register is doesn't do anything my guess is it's not saving to redis server?
michael@michael-HP-Pro3500-Series:~/Desktop/ten-poker-master/server$ stack run
"couldn't parse redishost from env default used"
"REDIS config: "
ConnInfo {connectHost = "localhost", connectPort = PortNumber 6379, connectAuth = Nothing, connectDatabase = 0, connectMaxConnections = 50, connectMaxIdleTime = 30s, connectTimeout = Nothing, connectTLSParams = Nothing}
This is not an issue. All it says is - you didn't pass in envinornment variables to override the Redis settings so we are going to use the defaults.
from poker-maison.
@therewillbecode That seemed to do it for me. Thanks!
from poker-maison.
Related Issues (20)
- Remove action buttons from game UI which represent invalid actions
- Add support for side pots
- GetProfile API Endpoint should also give some basic game stats for the user
- Add more Lobby tables when existing ones become full.
- Module not found: Error: Can't resolve './Counter.bs' HOT 2
- Monthly League Format?
- Send a list of possible valid actions to client from server
- Player's Max Bet Should Be Limited
- Use Servant-Pipes for streaming endpoints
- Unable to Build HOT 17
- Add bots to game HOT 7
- disable CORS HOT 2
- User Folds Automatically Too Quickly HOT 17
- Bug with another game HOT 4
- Connect remotely HOT 1
- when i run using docker-compose up, application started but login/signup failed saying COSR, when login the login is going to some other ip 192.168.*.* HOT 1
- cd server && stack run gives error HOT 1
- Extracting holdem game logic into separate package HOT 6
- poker-base!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poker-maison.