How can I validate the state param?

I answered something similar a while back. Let me know if this answers your question