Twitch.login not working

Hi, inside my project. i have implemented code to login to twitch using JS SDK. Yes, using this code:

$(‘.twitch-connect’).click(function() {
Twitch.login({
scope: [‘user_read’, ‘channel_read’]
});

When i click the button, it will redirect to the correct redirect page. However, it’s still said that

authenticated=false and token is undefined

It goes directly to the redirect page without going to sign in and approve page. Am i missing something here? Thank you