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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • erincof
    Indigo Rose Customer
    • Feb 2012
    • 5

    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
  • Ulrich
    Indigo Rose Staff Member
    • Apr 2005
    • 5103

    #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

    • erincof
      Indigo Rose Customer
      • Feb 2012
      • 5

      #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

      • Ulrich
        Indigo Rose Staff Member
        • Apr 2005
        • 5103

        #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:

        Click image for larger version

Name:	SNAP-2012-04-05-01.png
Views:	1
Size:	95.3 KB
ID:	283671

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

        Code:
        [COLOR="#008000"]-- Where do you want to download the installer/patch file from?[/COLOR]
        g_SourceURL [COLOR="#FF0000"]=[/COLOR] [COLOR="#800080"]"www.mydomain.com/folder/patch.exe"[/COLOR];
        g_HTTPTimeout [COLOR="#FF0000"]=[/COLOR] [COLOR="#000000"]30[/COLOR];
        g_HTTPPort [COLOR="#FF0000"]=[/COLOR] [COLOR="#000000"]80[/COLOR];
        g_HTTPUseBasicAuth [COLOR="#FF0000"]=[/COLOR] [COLOR="#0000FF"]true[/COLOR];
        g_HTTPAuthUsername [COLOR="#FF0000"]=[/COLOR] [COLOR="#800080"]"myuser"[/COLOR];
        g_HTTPAuthPassword [COLOR="#FF0000"]=[/COLOR] [COLOR="#800080"]"mypassword"[/COLOR];
        g_HTTPUseSSL [COLOR="#FF0000"]=[/COLOR] [COLOR="#0000FF"]false[/COLOR];
        g_HTTPTransferType [COLOR="#FF0000"]=[/COLOR] 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

        • erincof
          Indigo Rose Customer
          • Feb 2012
          • 5

          #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

          • Ulrich
            Indigo Rose Staff Member
            • Apr 2005
            • 5103

            #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

            • erincof
              Indigo Rose Customer
              • Feb 2012
              • 5

              #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