Best oauth method for local application

Your webserver serves a page that grabs the token then relays it from the frontend to the backend. Something like this is a rough example.


        if (document.location.hash && document.location.hash != '') {
            var parsedHash = new URLSearchParams(window.location.hash.substr(1));
            if (parsedHash.get('access_token')) {
                var access_token = parsedHash.get('access_token');
                fetch(
                    'http://localhost/?my_token=' + access_token
                )
                .then(resp => {})
                .catch(err => {
                    console.log(err);
                });
            }
        }

Sub http://localhost/ for whatever http://localhost:1234/ whatever port number you spawn up on