Andromo - Start Making Apps - Free Signup

Announcement

Collapse

New Forum Software

If you're here, you've found the new home for our forums. There will be some bugs to iron out, so thanks for your patience...
See more
See less

how can I access the value of g_HTTPAuthUsername variable from client script?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • how can I access the value of g_HTTPAuthUsername variable from client script?

    Hello:

    I am very new to programming in TrueUpdate 3.5

    I need my client scrpt to use HTTP Authentication login before it can download the server script. During build time, I entered my user name and password.

    In the client script, before:
    if(Screen.Show("Connect to Server") == SR_SUCCESS) then
    TrueUpdate.RunScript("Server Script");
    end

    I added this code:
    "Dialog.Message("The userName is "..g_HTTPAuthUsername);"

    But, when I run the client script, I get an Error:

    "Client Script, Line 37: attempt to concatenate global g_HTTPAuthUsername (a nil value)"

    How can I make the client script tell me what the value is?

    Thank you,

    Erin

  • #2
    Originally posted by erincof View Post
    I need my client scrpt to use HTTP Authentication login before it can download the server script. During build time, I entered my user name and password.
    I assume that you mean that you provided the username and password in the project wizard? Build time is when you compile the TrueUpdate client.

    "Client Script, Line 37: attempt to concatenate global g_HTTPAuthUsername (a nil value)"
    This means that at line 37, the contents of g_HTTPAuthUsername is still undefined. Post your project file, and we can point you your error.

    Ulrich

    Comment


    • #3
      Thank you Ulrich, yes, I meant to say that I provided my userName and passWord in the project wizard. I uploaded "login_with_auth.tu2" to whereever these things get uploaded

      Thank you,

      Erin

      Comment


      • #4
        Ok, here is how this works... In the wizard, you set the username and password for downloading the TrueUpdate control files. This information is saved in the Project Settings > TrueUpdate Servers dialog.

        For downloading the patch, there was an additional dialog with fields for providing a HTTP pasword, which apparently you left blank. This is the dialog:

        SNAP-2012-04-05-01.png

        Using these values as shown in the capture would create this in the Server Script:

        Code:
        -- Where do you want to download the installer/patch file from?
        g_SourceURL = "www.mydomain.com/folder/patch.exe";
        g_HTTPTimeout = 30;
        g_HTTPPort = 80;
        g_HTTPUseBasicAuth = true;
        g_HTTPAuthUsername = "myuser";
        g_HTTPAuthPassword = "mypassword";
        g_HTTPUseSSL = false;
        g_HTTPTransferType = MODE_BINARY;
        But no problem at all, you can write the username and password manually in the script afterwards - check lines 11 and 12 of the Server Script and provide the required values. You can update the TrueUpdate client from one location, and the application from another...

        Ulrich
        Last edited by Ulrich; 04-05-2012, 04:23 PM.

        Comment


        • #5
          Thank you Ulrich. From running the client script, how do I access the value of the username and password that I supplied to the wizard for downloading the server script?

          I ask because my IT department wants to know the actual username and password of the end user, not the username and password that I supplied to the wizard.

          Is it possible to supply these values to the client script at run time so that it passes the values to our web server? Or, must teh client script only use the parameters that it got from the wizard?

          Thank you,

          Erin

          Comment


          • #6
            Originally posted by erincof View Post
            Thank you Ulrich. From running the client script, how do I access the value of the username and password that I supplied to the wizard for downloading the server script?
            You don't. This is info is not available in the script, but you can see the data when you inspect the TrueUpdate servers.

            I ask because my IT department wants to know the actual username and password of the end user, not the username and password that I supplied to the wizard.
            I am not sure if I am following. What "end user" are you asking about?

            Is it possible to supply these values to the client script at run time so that it passes the values to our web server? Or, must teh client script only use the parameters that it got from the wizard?
            The Client script's purpose it to update the TrueUpdate client (and the data file) itself. Most likely, if you want to log the customer who is updating the application, this should happen in the Server script instead. You can do this by submitting HTTP form data, for example, or accessing some CGI script where you pass a customer code...

            Ulrich

            Comment


            • #7
              Thank you Ulrich. I now understand that when the client script runs, the user cannot supply a local username and password; the client script only knows the information provided from the wizard.

              I will have the server script relay the customer's username and password to our database.

              Thank you for your help!

              Erin

              Comment

              Working...
              X