Added function to generate user token.