token generation using flex