Provide OAuth Token
idoshamun opened this issue · comments
How can I provide an oauth token?
roer is always redirected to the login page
Same problem
In 66bada2, the ability to specify an API session token was added.
It's more of a workaround, but I've done the following to be able to use roer when gate is configured to authenticate with GitHub:
- Create a personal access token for the account you wish to login to Spinnaker as (I gave the following permissions: read:org, read:user, user:email)
- Use the following script to obtain a session token:
curl -c cookies.jar -Lv https://gate:8084/credentials -H "Authorization: Bearer $GITHUB_PERSONAL_ACCESS_TOKEN”
SPINNAKER_API_SESSION=$(awk '/SESSION/ { print $NF }' cookies.jar)
- Use roer with the API session key:
$ SPINNAKER_API=https://gate:8084 roer --as ${SPINNAKER_API_SESSION} app list
Thanks @nextrevision
I tried to replicate this with Gitlab OAUTH and also Gitlab Personal Access Tokens but was unsuccessful.
In the end I found another way to get an existing SESSION ID via Chrome browser.
- Sign in to Spinnaker via Deck (I have OAUTH enabled)
- Visit
https://<your Deck URL>/pipelineTemplates
in Chrome. - Open Chrome developer tools.
- Reload page.
- View Network -> pipelineTemplates
- Search through the text for
cookie: SESSION=<your session id here>
- Continue on with step 3 from above. You may need to export or prefix the roer command with SPINNAKER_API_SESSION.