Really bad implementation of oauth flow, but it works for now