Add authorize phase and check token logic