Automated ldap login for 6.x

I am trying to figure out how to login from an automation container. In my setup I have LDAP so I have been following this

I am using Concourse 6.0.0.

Everything seems to work until we get to the cookie part. For the life of me I cannot figure out why after a valid login no cookies are set. Is this a change in Concourse 6.0? Is there anyway I can work around this?

For ease, here is the copy of the script I have been using:

## Variables required

## Create a file named token that will be used to read and write tokens 
touch token 

## extract the LDAP authentication url and write to token file
LDAP_AUTH_URL=$CONCOURSE_URL$(curl -b token -c token -L "$CONCOURSE_URL/sky/login" -s | grep "/sky/issuer/auth/ldap?" | awk -F'"' '{print $2}')
# login using username and password while writing to the token file 
curl -s -o /dev/null -b token -c token  -L --data-urlencode "login=$CONCOURSE_USER" --data-urlencode "password=$CONCOURSE_PASSWORD" "$LDAP_AUTH_URL"

# Extract Bearer Token
ATC_BEARER_TOKEN=$(cat token | grep -o -P '(?<=Bearer\ ).*(?=\")')

# Build your .flyrc
cat <<ENDOFSCRIPT >> ~/.flyrc
      type: Bearer
      value: $ATC_BEARER_TOKEN

fly -t  $CONCOURSE_TARGET  <your_command>

I know this is similar to How to get concourse auth token when I login concourse in the without browser Linux server and Automate concourse oauth login. However, I have no issue with the configuration of Concourse. I just have issue getting the cookie / token.

I figured it out. Turned out I needed to add -k to each of the curl commands.