# VSCode \>= 4.60 and getting a enter password prompt

**URL:** <https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427>\
**Category:** Get Help\
**Created:** [January 10, 2023, 3:20pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427 "2023-01-10T15:20:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [January 10, 2023, 3:20pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/1 "2023-01-10T15:20:51Z")

</div>

Hi, I’m trying to run VSCode 4.9.1 (and also tried 4.6.0 to match existing threads about VSCode), but the issue I’m having isn’t a URL rewrite (as far as I know). It seems to be a password issue.

I won’t post all of the internal application files, but I am creating/setting a password in the before.sh.erb file, that password is being recognized in the script.sh.erb file (I print out the password to stdout just so I can see it being set).

The VSCode server launches, but when I click on the connection link in OOD, I’m taken to the ‘Welcome to code-server, Please log in below password was set from $PASSWORD’ screen. If I paste in the password that was printed in the output, I’m logged in and it seems to work.

Does anyone know how to get past the welcome screen and just have VSCode launch without that extra step?

Thanks.

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [January 10, 2023, 3:49pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/2 "2023-01-10T15:49:19Z")

</div>

Sorry for the trouble.

It may be that you just need to ensure that password is posted to the app at launch.

You’ll have to edit the `view.html.erb` to have something like

```auto
<form id="<%= form_id %>" action="/rnode/<%= host %>/<%= port %>/login?to=" method="post" target="_blank">
  <input type="hidden" name="password" value="<%= password %>">
  <button class="btn btn-primary" type="submit">
    <i class="fa fa-cogs"></i> Connect to VS Code
  </button>
</form>

```

And I think that should do it.

If you’re using more than one version of codeserver and want to select that in the `form` there are some extra steps needed as well, but I’m reading this as just one version is used, is that correct?

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [January 10, 2023, 3:50pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/3 "2023-01-10T15:50:11Z")

</div>

well, step 1 is to see if the newer version works, then I’m going to see about making a multi-version app…but right now just trying to get the one working. Let me see what I find.

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [January 10, 2023, 3:53pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/4 "2023-01-10T15:53:17Z")

</div>

I think it’s closer, but still doesn’t work. My created URL is now this:

[https://ondemand/rnode/computenode1/51999/login?password=4qF5i0Q8zgHgEVBd](https://ondemand/rnode/computenode1/51999/login?password=4qF5i0Q8zgHgEVBd)  
but I still have the ‘enter password’ screen.

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [January 10, 2023, 3:58pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/5 "2023-01-10T15:58:08Z")

</div>

Ok, I’m going to post the steps for multi-version selection as well for completeness.

In the `form.yml`:

```auto
---
cluster: "my_cluster"
form:
  ...
  - version
  ...
attributes:
  ...
  version:
    widget: "select"
    label: "Codeserver Version"
    options:
      - ["4.3", "4.3.1"]
      - ["4.6", "4.6.0"]
      - ["4.9", "4.9.1"]

```

In the `template/before.sh` add:

```auto
...
export code_server_version="<%= context.version %>"
...

```

In the `submit.yml.erb`:

```auto
---
batch_connect:
  template: "basic"
  conn_params:
    - code_server_version

```

And in the `view.html.erb` use some logic to use different REST calls based on the version number:

```auto
<% if code_server_version >= '4.6.1' %>
<form id="<%= form_id %>" action="/rnode/<%= host %>/<%= port %>/login?to=" method="post" target="_blank">
  <input type="hidden" name="password" value="<%= password %>">
<% else %>
<form id="<%= form_id %>" action="/rnode/<%= host %>/<%= port %>/" method="get" target="_blank">
<% end %>
  <button class="btn btn-primary" type="submit">
    <i class="fa fa-cogs"></i> Connect to VS Code
  </button>
</form>

```

This would allow older versions that don’t need to `POST` the password to just use a `GET` instead for example.

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [January 10, 2023, 3:59pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/6 "2023-01-10T15:59:38Z")

</div>

Thanks for that, that’ll save me a bunch of time. Still getting the login page though, even if I open a web browser directly on the server.

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [January 10, 2023, 4:00pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/7 "2023-01-10T16:00:53Z")

</div>

Hmm, ok, let me do some testing on my end. I’ve had to deal with this previously and the app can be finicky in these later version due to some upstream changes they made, sorry about the trouble.

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [January 11, 2023, 2:37pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/8 "2023-01-11T14:37:29Z")

</div>

Could I see the `template/script.sh.erb` file? Specifically the call to `codeserver` itself that is used and what options are being passed is what I am looking to see.

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [January 11, 2023, 3:01pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/9 "2023-01-11T15:01:14Z")

</div>

```auto
#!/usr/bin/bash -l
<%

# Determine the application root from session token.
app_root = BatchConnect::App.from_token(session.token).root.realpath

# Set our working directory.
working_dir = Pathname.new(context.working_dir)

# Ensure that code-server always starts up in either a user defined directory or the home directory.
if ! working_dir.exist?
    working_dir = Pathname.new(ENV['HOME'])
elsif working_dir.file?
    working_dir = working_dir.parent
end
%>

# Setup environment
APP_ROOT="<%= app_root.to_s %>"
CODE_SERVER_DATAROOT="$HOME/.local/share/code-server"
mkdir -p "$CODE_SERVER_DATAROOT/extensions"

# Expose the password to the server.
#export PASSWORD="$password"
#echo "PASSWORD: $password"

# Print compute node.
echo "$(date): Running on compute node ${compute_node}:$port"

# VSCode complains that system git is too old.
module load git/2.34 app_code_server/<%= context.version %>

CPP_FILE="<%= working_dir.to_s %>/.vscode/c_cpp_properties.json"

if [[-f "$CPP_FILE"]]; then
    CPP_DIR="${TMPDIR:=/tmp/$USER}/cpp-vscode"
    mkdir -p "$CPP_DIR"
    chmod 700 "$CPP_DIR"

    # if the file is empty, let's initialize it
    [-s "$CPP_FILE"] || echo '{"configurations": [{ "name": "Linux", "browse": { "databaseFilename": null }}], "version": 4}' > "$CPP_FILE"

    jq --arg dbfile "$CPP_DIR/cpp-vscode.db" \
      '.configurations[0].browse.databaseFilename = $dbfile' \
      "$CPP_FILE" > "$CPP_FILE".new

    mv "$CPP_FILE".new "$CPP_FILE"
  fi

#
# Start Code Server.
#
echo "$(date): Started code-server"
echo ""

module load git/2.34
/path/to/code-server-4.9.1-linux-amd64/bin/code-server \
    --auth="password" \
    --bind-addr="0.0.0.0:${port}" \
    --disable-telemetry \
    --disable-update-check
    --extensions-dir="$CODE_SERVER_DATAROOT/extensions" \
    --user-data-dir="$CODE_SERVER_DATAROOT" \
    --ignore-last-opened \
    --reuse-window \
    --log debug \
    "<%= working_dir.to_s %>"

```

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [January 17, 2023, 1:42pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/10 "2023-01-17T13:42:33Z")

</div>

Just looking a little deeper. It seems like VSCode wants a cookie with a hashed password set as a key= value ([Setting/passing password as cookie is not working anymore · Issue #1189 · coder/code-server · GitHub](https://github.com/coder/code-server/issues/1189))

As a quick test I just manually started up vscode and got the login screen at the url:  
localhost:9999 (it auto-redirects me to /login). I enter the password, and the URL changes to localhost:9999/?key=12345

However, if I try to directly use that URL on a new session, I still get the login screen, so that makes me think it’s a cookie being used. The URL gets rewritten when I do this to: localhost:9999/login?key=12345&to=, so that password can’t be entered directly on the URL.

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [March 23, 2023, 12:13pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/12 "2023-03-23T12:13:22Z")

</div>

Just want to mention that I was able to get this working after re-downloading the latest copy of [GitHub - OSC/bc\_osc\_codeserver: BETA - Batch Connect - OSC Code Server](https://github.com/OSC/bc_osc_codeserver.git)

I noticed there were a couple of extra lines in the view.html.erb that may have been the trick. Modifying the config files for our cluster, I was able to bring up code server 4.11 with no issue.

---

<div class="post-metadata">

**Author:** ![groucho64738](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/groucho64738/32/721_2.png) [@groucho64738](https://discourse.openondemand.org/u/groucho64738)\
**Post date:** [March 23, 2023, 12:18pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/13 "2023-03-23T12:18:40Z")

</div>

Side question, for installing extensions, the web page load that has the extension description won’t display. Does anyone have that working? I just get a ‘firefox can’t load this page’, then has a button to launch in a new window, and that doesn’t work either.

---

<div class="post-metadata">

**Author:** ![wfeinstein](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/wfeinstein/32/767_2.png) [@wfeinstein](https://discourse.openondemand.org/u/wfeinstein)\
**Post date:** [April 28, 2023, 3:57pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/14 "2023-04-28T15:57:54Z")

</div>

Dear all,

I am trying to add newer versions of vscode and got the same “passwd prompt” issue. I have tried vscode/4.8.3 and 4.11.0 and 4.12.0.

Using the code “”, the initial repetitive "passwd prompt " went away, but I got “Not found.” with the URL shown below:

[https://lrc-ondemand.lbl.gov/rnode/n0000.ood0/61073/rnode/n0000.ood0/61073/](https://lrc-ondemand.lbl.gov/rnode/n0000.ood0/61073/rnode/n0000.ood0/61073/)

In contrast, for the working version vscode/3.8.0 I have, the URL would be something in the format like "[https://lrc-ondemand.lbl.gov/rnode/n0000.ood0/61073/](https://lrc-ondemand.lbl.gov/rnode/n0000.ood0/61073/)? "

Any advises?

Thank you very much.  
Wei

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [April 28, 2023, 4:07pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/15 "2023-04-28T16:07:27Z")

</div>

There is different logic VSCode uses to login. Here’s the if block we use for our different versions. That may fix the redirect issues too. If it doesn’t let me know what OnDemand version you’re on - we may have patched that issue (you see that there are duplicate `rnode` items in the URL).

> <https://github.com/OSC/bc_osc_codeserver/blob/2db78f83f6d92162e6600196da5df2b2a821293c/view.html.erb#L26-L31>

---

<div class="post-metadata">

**Author:** ![wfeinstein](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/wfeinstein/32/767_2.png) [@wfeinstein](https://discourse.openondemand.org/u/wfeinstein)\
**Post date:** [April 28, 2023, 9:07pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/16 "2023-04-28T21:07:15Z")

</div>

Hi Jeff,

We are use an old version: v1.8.18, any suggestions for the duplicated `rnode` items in the URL.

We have a plan to upgrade in the near future, but not there yet.

Thank you,  
Wei

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [May 1, 2023, 2:35pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/17 "2023-05-01T14:35:16Z")

</div>

You can hot patch your system if you need, but I don’t know if it’s suggestible or what side affects you’d have. If you do, please back up all the files you edit.

You’d probably need to edit the template (`/opt/ood/ood-portal-generator/templates/ood-portal.conf.erb`), not the resulting file (`/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf`).

You’d want to apply this patch that accounts for relative paths.

> <https://github.com/OSC/ondemand/pull/1934/files#diff-172055f1236a42fea9b685b9b0c76a26de6fce1d37715b0a22129ce35326e533>
>
> Fixes #1931 to additionally check for relative urls.
> 
> 
> 
> ┆Issue is synchronized w…ith this \[Asana task\](https://app.asana.com/0/1201735133575781/1202053498682560) by \[Unito\](https://www.unito.io)

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [May 1, 2023, 2:35pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/18 "2023-05-01T14:35:46Z")

</div>

Which is to say - this issue was patched in 2.0, so an update may just fix the issue directly.

---

<div class="post-metadata">

**Author:** ![wfeinstein](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/wfeinstein/32/767_2.png) [@wfeinstein](https://discourse.openondemand.org/u/wfeinstein)\
**Post date:** [May 1, 2023, 5:29pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/19 "2023-05-01T17:29:33Z")

</div>

Thank you Jeff!

I changed /opt/ood/ood-portal-generator/templates/ood-portal.conf.erb.

However

-bash-4.2# pwd  
/opt/ood/ood-portal-generator/spec/fixtures  
-bash-4.2# ls ood\*  
ood-portal.conf.default ood-portal.conf.dex-full ood-portal.conf.maint\_with\_ips ood-portal.conf.oidc ood\_portal.yaml.port  
ood-portal.conf.dex ood-portal.conf.dex-ldap ood-portal.conf.nomaint ood-portal.conf.oidc-ssl

The file ood-portal.conf.all seems to be missing from the OOD version (v1.8.18) we are using.

Thank you,  
Wei

---

<div class="post-metadata">

**Author:** ![jeff.ohrstrom](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/jeff.ohrstrom/32/136_2.png) [@jeff.ohrstrom](https://discourse.openondemand.org/u/jeff.ohrstrom)\
**Post date:** [May 1, 2023, 5:31pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/20 "2023-05-01T17:31:24Z")

</div>

Those are just test files. Files we use to run and validate tests against, so there’s no issue there. `/opt/ood/ood-portal-generator/templates/ood-portal.conf.erb` the only file you should need to update.

---

<div class="post-metadata">

**Author:** ![wfeinstein](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/wfeinstein/32/767_2.png) [@wfeinstein](https://discourse.openondemand.org/u/wfeinstein)\
**Post date:** [May 2, 2023, 10:09pm UTC](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427/21 "2023-05-02T22:09:49Z")

</div>

Hi Jeff,

Still get the same error message (below) with the patch.

[https://lrc-ondemand.lbl.gov/rnode/n0000.ood0/24807/rnode/n0000.ood0/24807/](https://lrc-ondemand.lbl.gov/rnode/n0000.ood0/24807/rnode/n0000.ood0/24807/)

The problem applies to vscode below  
- [“4.8”, “4.8.3”]  
- [“4.11”, “4.11.0”]

The older version [“3.8”, “3.8.0”] has no problem, works before and after the patch.

Thanks,  
Wei

[Next page](https://discourse.openondemand.org/t/vscode-4-60-and-getting-a-enter-password-prompt/2427.md?page=2)
