Can you post your task config? Just a guess before actually seeing your
config is that you might be putting ${GOCD_ACCESS_TOKEN} as a raw argument.
Since the arguments are effectively shell-escaped, `curl` might be sending
the literal text ${GOCD_ACCESS_TOKEN} instead of interpolating your secret
variable.The solution to that is to either: - Wrap your `curl` call with `bash -c`, or - Wrap this in a script and call your script In either case above, curl will receive the interpolated value. But, let's take a look at your task config to confirm what's going on. Best, Marques On Thu, Feb 18, 2021 at 1:58 PM Gabriel Callaghan < [email protected]> wrote: > Hi, > > I have a script which does an API call. To authenticate myself, I use a > token. > > $ curl ' > https://ci.example.com/go/api/stages/mypipeline/defaultStage/history' \ > -H "Authorization: Bearer ${GOCD_ACCESS_TOKEN}" \ > -H 'Accept: application/vnd.go.cd.v3+json' > > When I use this api, if in my script I use my personal access token > generated by GOCD, the call works. However, if I have the same API call > with the same token, but the token is inside the secure variable section of > the pipeline, and called using ${GOCD_ACCESS_TOKEN}, I am unable to get > authenticated. > > I have tried to hash the token to see if it matches. When doing cksum on > my personal token inside my script, I get a different result from if I did > cksum <<<${GOCD_ACCESS_TOKEN}. > > I am a junior, so I have much to learn and I would apperciate any help in > understanding how to resolve this issue. > > Thank you :) > Gabes. > > -- > You received this message because you are subscribed to the Google Groups > "go-cd" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/go-cd/2a219c35-6c78-4ae3-8070-1e2a54118638n%40googlegroups.com > <https://groups.google.com/d/msgid/go-cd/2a219c35-6c78-4ae3-8070-1e2a54118638n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "go-cd" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/go-cd/CAPKX9jZAnKGrupURs%3DrmR5FXceBowfG_WLQFUFdVPEYnqut70A%40mail.gmail.com.
