Login Success as admin
<form class='form' method="POST">
    username<input name="username">
    password<input name="password">
    <button type='button' id='submit'>submit</button>
</form>
<script src="https://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
    const oneid_base_url = 'http://192.168.31.62:8000'
    const urlParams = new URLSearchParams(window.location.search);
    const redirect_url = urlParams.get('next');
    let next = oneid_base_url + redirect_url;
    next = next.replace('_authorize', 'authorize', 1)

    $('#submit').click(function(){
        username = $('input[name=username]').val();
        password = $('input[name=password]').val();
        $.ajax({
            method: 'POST',
            url: '{{token_url}}',
            data: {'username': username, 'password': password},
            success: function(data){
                token = data['token']
                localStorage.setItem('token', data['token']);
                const urlParams = new URLSearchParams(next);
                if (urlParams.get('oneid_token')){
                    next = next.replace('oneid_token', '_oneid_token');
                }
                next = next + "&oneid_token=" + token
                console.log("next is" + next)
                window.location.href = next;
            }
        })
        return false;
    })
</script>
