i got the the idea of an secure alternative login process using an eos smart contract instead using firebase or amazon cognito. I would like to know if something like this feasible?

My idea is somewhat like. 

 1. server creates cookie with a specific id
 2. server sends cookie with id to client
 3. client gets cookie with unique id from server
 4. client wants to login so he executes a action "Login" from contract and writes the id he got form server in form of a hash256 in the contract (contract writes the timestamp of execution also in the table)
 5. client send message to the server when the action was successful that he wants to login. 
 6. server looks the eos contract table up for the name and if the entry is not older than 1-2sec and checks if the hashed id is the same as the server gave to the client. 
 7. is everything ok, the client gets a session and can see his private data or whatever the website returns.   

(server could be something like node.js with express-session and reactjs/vue/angular as front-end) 

i don't know if this is a secure way to do this or an alternative for firebase auth and amazon cognito. I would also be interested in other thoughts,how one could realize something like that.