OAUTH2 working, functions are messy though, need to clean up