portainer-stack-deploy icon indicating copy to clipboard operation
portainer-stack-deploy copied to clipboard

Authentication via API token instead of username/password

Open skraus-dev opened this issue 2 years ago • 6 comments

Starting with portainer v2.11+ a new authentication schema was introduced:

  • API token (Header: X-API-Token)

Would it be desirable to have this option available in the github action?

Reference: https://docs.portainer.io/v/ce-2.11/api/access

skraus-dev avatar Aug 05 '22 11:08 skraus-dev

Sounds good to me. I'm considering removing the username/password option completely. This will simplify the code a bit (we can remove some code). However, it will be a breaking change so we will probably need to release a new major version. Thoughts?

carlrygart avatar Aug 07 '22 21:08 carlrygart

Sorry for the late response!

Sounds good to me.

Hopefully portainer will implement more granular control / scopes into the API Token mechanism at some point, so you don't need a new user account for a narrow permission scope. Anyway, that's out of scope for this repo/ action / issue.

skraus-dev avatar Sep 16 '22 02:09 skraus-dev

API token support would be great. Trying with username and password on version 2.18.4 but getting this error: Logging in to Portainer instance... Error: AxiosError HTTP Status 404 (post /auth): 404 page not found

You can workaround the auth error by changing the host to include https://{hosturl}/#!/ but then hit other portainer function errors: Error: TypeError: allStacks.find is not a function

bignellrp avatar Aug 31 '23 21:08 bignellrp

@bignellrp Here is my github action, hope that can help you.

https://github.com/marketplace/actions/portainer-deployment

datntdev0 avatar Oct 28 '23 14:10 datntdev0

@bignellrp Here is my github action, hope that can help you.

https://github.com/marketplace/actions/portainer-deployment

Thanks but this is giving a 404?

bignellrp avatar Oct 29 '23 11:10 bignellrp

@bignellrp Here is my github action, hope that can help you. https://github.com/marketplace/actions/portainer-deployment

Thanks but this is giving a 404?

The action is renamed: https://github.com/marketplace/actions/deploy-to-portainer

datntdev0 avatar Oct 30 '23 14:10 datntdev0