OAuth2 on client side works fine but server side gives errors