So this is a duplicate post of?
Please don’t create duplicate posts.
Generally speaking for that sort of view/implementatation you want to be using implicit auth instead, to prevent leaking your secret (as far as I know): Getting OAuth Access Tokens | Twitch Developers