ionos-cloud / ionosctl

The IONOS Cloud CLI (ionosctl) gives the ability to manage IONOS Cloud infrastructure directly from Command Line.
Apache License 2.0
30 stars 6 forks source link

Can't use API Token #99

Closed debackerl closed 2 years ago

debackerl commented 3 years ago

Description

I exported my API Token to environment variables ONEANDONE_TOKEN and IONOS_TOKEN, but when I try to use ionosctl, it will show:

Error: stat /home/XXX/.config/ionosctl/config.json: no such file or directory

The API Token is accepted when using the Cloud Server API v1 (https://cloudpanel-api.ionos.com/documentation/index_en.html). I activated it using your official support page: https://www.ionos.fr/assistance/serveurs-et-cloud/administration-via-le-cloud-panel/api/activer-la-cle-api/

Expected behavior

Being able to you ionosctl.

Environment

Go Version:

go version go1.16.7 linux/amd64

Ionosctl version:

ionosctl version 5.0.7

OS:

Pop_OS! Linux 21.04

Shell:

bash

Configuration Files

ONEANDONE_TOKEN=XXXXX IONOS_TOKEN=XXXXX

How to Reproduce

  1. Create API Token in Cloud Server section, as described in https://www.ionos.fr/assistance/serveurs-et-cloud/administration-via-le-cloud-panel/api/activer-la-cle-api/
  2. Export it as ONEANDONE_TOKEN and IONOS_TOKEN
  3. Check with env command line that it is now available.
  4. Run any command like ionos image lsit

Error and Debug Output

If I export IONOS_USERNAME and IONOS_PASSWORD, then it will simply say that I'm Unauthorized. I tried email, customer number, and user created in Cloud Server section with API Access activated, all denied. I checked the password each time.

Additional Notes

Do I need to specify a different API endpoint because I subscribed on ionos.fr ?

References

I could manually use https://cloudpanel-api.ionos.com/documentation/index_en.html but you use https://api.ionos.com/docs/cloud/v5/

I'm not sure to understand why you have two APIs in parallel.

Thank you!

ana-moga commented 3 years ago

Hello,

This has been fixed in release v5.0.8.

Note: Regarding the credentials used, IONOS_USERNAME, IONOS_PASSWORD - they are the ones used to authenticate here.

jbuchhammer commented 3 years ago

Hi @debackerl , It's just a misunderstanding:

IONOS originated from two different companies with two different products:

This is why there are 'two APIs in parallel' and different credentials for each of both products.

Unforntunately, the 'classical' IONOS servers are also shown in the IONOS cloud overview which may have led to this confusion. Sorry for that.

[update:] Ouch, I forgot the most important point: ionosctl is for the IONOS cloud (api.ionos.com/cloudapi/v5)

ana-moga commented 3 years ago

Hello,

If there are any other comments on this, let us know. If not, will close the issue.

Thank you, Ana