Auto-Login on Webpage using Javascript

  • 2
  • Question
  • Updated 1 year ago
  • Answered
Hi Folks!

I'm pretty new at this whole programming thing and RV as a whole, so I have a question on how to go about this - Is there anyway to auto-login to a webpage (using Web Page Widget - or any other method I suppose) with an embedded java script? This site I want to be able to auto-login needs to be done during POST, as it does not accept the GET method ("www.example.com?username=bob&password=smith24"). The script I would like to implement, already works in a separate environment, outside of RV and Web Page Widget, implemented on the client side. 

Thanks in advance,
Photo of Alex Coombs

Alex Coombs

  • 102 Points 100 badge 2x thumb

Posted 2 years ago

  • 2
Photo of Blake Freeman

Blake Freeman, Official Rep

  • 36,116 Points 20k badge 2x thumb
Hi Alex,

I'm not a developer, so I don't have any input of my own on this question, but I did find this article that may be interesting to you.

We'd be very interesting in know if you solve this problem!
Photo of Darius - PRODO.us

Darius - PRODO.us, Champion

  • 26,850 Points 20k badge 2x thumb
I am trying this out today!
Photo of Alex Coombs

Alex Coombs

  • 102 Points 100 badge 2x thumb
Okay, cool. I see if I can get this to work inside RV. Thanks Blake! I'll comment back after I test (about a day or two).
Photo of Darius - PRODO.us

Darius - PRODO.us, Champion

  • 26,850 Points 20k badge 2x thumb
Alex, could you share the script with us that works outside RV. I would like to test it with my YouTube Red account.
(Edited)
Photo of Alex Coombs

Alex Coombs

  • 102 Points 100 badge 2x thumb
Unfortunately, it is very specific to the site that it is being used with. 
Photo of Robb

Robb, Official Rep

  • 76,676 Points 50k badge 2x thumb
Alex, were you able to get this working with the method mentioned by Blake?
Photo of Brian Miller

Brian Miller

  • 60 Points
Alex,

I have used a version of the following code placed in the html widget to successfully log into secured web pages.

<HTML><HEAD>
<script >
    function login() {

        document.forms[0].action = "http://www.example.com";
        document.forms[0].submit();
    }
</script>
</HEAD>
<BODY onLoad="login()">

    <form action="http://www.example.com"; method="post">
                    
<input type="hidden" name="login" value="1" />
    <input type="hidden" name="username" value="bob" />
        <input type="hidden" name="password" value="smith24" />
</form>
    
    
</BODY>
</HTML>
Photo of Darius - PRODO.us

Darius - PRODO.us, Champion

  • 26,850 Points 20k badge 2x thumb
Brian, I gave it a shot yesterday and it did not work with YouTube. I am not getting how exactly I post the webpage I am trying to access. Currently I am using iFrame to embed YouTube playlists, so I simply added this part of code to the existing. Do I need to add this as a separate widget with this code in my presentation or merge it with the existing HTML code I am using to embed YouTube playlist? How do I connect those?
Photo of Enrico Stahn

Enrico Stahn

  • 112 Points 100 badge 2x thumb