scaleway / scaleway-cli

Command Line Interface for Scaleway

Home Page:https://www.scaleway.com/en/cli/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

scw login not work : token_id: [extra keys not allowed]

1Fopresta opened this issue · comments

Hi, i use the cli version 1.9.0 and when i try to login i obtain an error :

scw -V -D login --token=<token_id> --organization=<organisation_id>
DEBU[0000] curl -X GET -H "Content-Type: application/json" -H "User-Agent: scw/v1.8.1" -H "X-Auth-Token: 00000000-0000-1000-0000-000000000000" https://account.scaleway.com/tokens?token_id=00000000-0000-1000-0000-000000000000
DEBU[0000] Validation Error Message= StatusCode=400 Type=invalid_request_error
DEBU[0000] token_id: [extra keys not allowed]
FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: Validation Error

Hi @1Fopresta ☺️,

Can you retry with the CLI from master branch ?.

You have an old version -H "User-Agent: scw/v1.8.1"

Same problem with the master branch :

FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

it work for me, can you provide me your version ?

$ ./scw version
Client version: v1.9.0+dev
Go version (client): go1.7.3
Git commit (client): 37f3812
OS/Arch (client): darwin/amd64

Client version: v1.9.0+dev
Go version (client): go1.7.3
Git commit (client):
OS/Arch (client): linux/amd64

Same issue here:

DEBU[0000] curl -X GET -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0" -H "X-Auth-Token: 00000000-0000-1000-0000-000000000000" https://account.scaleway.com/tokens?token_id=00000000-0000-1000-0000-000000000000
DEBU[0000] Validation Error                              Message= StatusCode=400 Type=invalid_request_error
DEBU[0000]   token_id:                      [extra keys not allowed]
FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: Validation Error
scw version
Client version: v1.9.0
Go version (client): go1.7.1
Git commit (client): homebrew
OS/Arch (client): darwin/amd64

I don't have issue with the latest version.

./scw login
Login (cloud.scaleway.com): qperez@ocs.online.net
Password:
Do you want to upload an SSH key ?
[0] I don't want to upload a key !
[1] github.pub
[2] id_boot2docker.pub
[3] id_rsa.pub
[4] ocs.pub
Which [id]: 0

You are now authenticated on Scaleway.com as Quentin Perez.
You can list your existing servers using `scw ps` or create a new one using `scw run ubuntu-xenial`.
You can get a list of all available commands using `scw -h` and get more usage examples on github.com/scaleway/scaleway-cli.
Happy cloud riding.
./scw version
Client version: v1.9.0+dev
Go version (client): go1.7.1
Git commit (client): 37f3812
OS/Arch (client): darwin/amd64

I will release a new version soon.

Same problem here: got the latest version of the client since i can't login (got the same error).

Hi @eilgin

Can you give me the output of these commands ./scw version and ./scw -V -D login as my example above ?

output of ./scw version :

Client version: v1.9.0+dev
Go version (client): go1.7.3
Git commit (client):
OS/Arch (client): linux/amd64

output of ./scw -V -D login 2> out.txt :

time="2016-10-23T22:02:24+02:00" level=debug msg="curl -X POST -d "{"email":"NOPE","password":"XX-XX-XX-XX","description":"scw-sleeper","expires":false}" -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: " 'https://account.scaleway.com/tokens'" 
time="2016-10-23T22:02:24+02:00" level=debug msg="POST /tokens HTTP/1.1\r
Host: account.scaleway.com\r
Content-Type: application/json\r
User-Agent: scw/v1.9.0+dev\r
X-Auth-Token: \r
\r
{"email":"NOPE","password":"NOPE","description":"scw-sleeper","expires":false}
" 
time="2016-10-23T22:02:25+02:00" level=debug msg="curl -X HEAD -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: NOPE" 'https://account.scaleway.com/organizations'" 
time="2016-10-23T22:02:25+02:00" level=debug msg="HEAD /organizations HTTP/1.1\r
Host: account.scaleway.com\r
Content-Type: application/json\r
User-Agent: scw/v1.9.0+dev\r
X-Auth-Token: NOPE\r
\r
" 
time="2016-10-23T22:02:25+02:00" level=debug msg="curl -X GET -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: NOPE" 'https://account.scaleway.com/organizations'" 
time="2016-10-23T22:02:25+02:00" level=debug msg="GET /organizations HTTP/1.1\r
Host: account.scaleway.com\r
Content-Type: application/json\r
User-Agent: scw/v1.9.0+dev\r
X-Auth-Token: NOPE\r
\r
" 
time="2016-10-23T22:02:25+02:00" level=debug msg="[Response]: [200]
{
  "organizations": [
    {
      "address_line2": null,
      "address_country_code": "FR",
      "address_line1": "NOPE",
      "support_level": "basic",
      "name": "tom",
      "modification_date": "2016-10-23T17:41:37.530000+00:00",
      "currency": "EUR",
      "locale": "en_US",
      "customer_class": "individual",
      "support_id": "NOPE",
      "creation_date": "2016-10-23T16:47:28.224238+00:00",
      "address_postal_code": "NOPE",
      "address_city_name": "PARIS",
      "address_subdivision_code": null,
      "timezone": "UTC",
      "vat_number": null,
      "support_pin": "5051",
      "id": "d7f07169-12fc-4cef-a1dd-cc34eda1465d",
      "warnings": [
        {
          "reason": "validate_tos",
          "locked_at": "2016-10-23T16:47:28.224238+00:00",
          "opened_at": "2016-10-23T16:47:28.224238+00:00",
          "closable_by_user": true,
          "closed": true,
          "closed_at": "2016-10-23T16:48:01.769535+00:00",
          "locking": true,
          "id": "b40a4086-6042-473d-9ac2-375cbd8b73a8"
        },
        {
          "reason": "validate_email",
          "locked_at": "2016-10-23T16:47:28.224238+00:00",
          "opened_at": "2016-10-23T16:47:28.224238+00:00",
          "closable_by_user": true,
          "closed": true,
          "closed_at": "2016-10-23T16:48:16.406270+00:00",
          "locking": true,
          "id": "8d2fc9c3-74e7-4c29-8ed0-963cbb355eec"
        },
        {
          "reason": "billing_info_missing",
          "locked_at": "2016-10-23T16:47:28.224238+00:00",
          "opened_at": "2016-10-23T16:47:28.224238+00:00",
          "closable_by_user": false,
          "closed": true,
          "closed_at": "2016-10-23T17:36:37.160130+00:00",
          "locking": true,
          "id": "5d93da6f-bf40-432d-8b7a-e8fbbf62a6da"
        },
        {
          "reason": "payment_info_missing",
          "locked_at": "2016-10-23T16:47:28.224238+00:00",
          "opened_at": "2016-10-23T16:47:28.224238+00:00",
          "closable_by_user": false,
          "closed": true,
          "closed_at": "2016-10-23T17:41:37.486372+00:00",
          "locking": true,
          "id": "f134b617-d973-49f8-a8bc-400e6b92f31b"
        },
        {
          "reason": "phone_missing",
          "locked_at": null,
          "opened_at": "2016-10-23T16:47:28.224238+00:00",
          "closable_by_user": false,
          "closed": true,
          "closed_at": "2016-10-23T17:41:37.486372+00:00",
          "locking": false,
          "id": "dec3d7f0-f447-4d16-9faf-711a118d26b0"
        }
      ],
      "users": [
        {
          "phone_number": null,
          "firstname": "",
          "lastname": "",
          "creation_date": "2016-10-23T16:47:28.224238+00:00",
          "ssh_public_keys": [
            {
              "key": "ssh-rsa NOPE eilgin@OMEGA",
              "fingerprint": "2048 NOPE  eilgin@OMEGA (RSA)"
            }
          ],
          "id": "cd2c650b-6cb0-4c4b-bac9-846da65c445e",
          "organizations": [
            {
              "id": "d7f07169-12fc-4cef-a1dd-cc34eda1465d",
              "name": "tom"
            }
          ],
          "modification_date": "2016-10-23T19:13:17.695745+00:00",
          "roles": [
            {
              "organization": {
                "id": "d7f07169-12fc-4cef-a1dd-cc34eda1465d",
                "name": "tom"
              },
              "role": "admin"
            }
          ],
          "fullname": null,
          "email": "NOPE"
        }
      ]
    }
  ]
}" 
time="2016-10-23T22:02:25+02:00" level=debug msg="curl -X HEAD -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: NOPE" 'https://account.scaleway.com/tokens'" 
time="2016-10-23T22:02:25+02:00" level=debug msg="HEAD /tokens HTTP/1.1\r
Host: account.scaleway.com\r
Content-Type: application/json\r
User-Agent: scw/v1.9.0+dev\r
X-Auth-Token: NOPE\r
\r
" 
time="2016-10-23T22:02:25+02:00" level=debug msg="curl -X GET -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: NOPE" 'https://account.scaleway.com/tokens?token_id=NOPE'" 
time="2016-10-23T22:02:25+02:00" level=debug msg="GET /tokens?token_id=NOPE HTTP/1.1\r
Host: account.scaleway.com\r
Content-Type: application/json\r
User-Agent: scw/v1.9.0+dev\r
X-Auth-Token: NOPE\r
\r
" 
time="2016-10-23T22:02:25+02:00" level=debug msg="[Response]: [400]
{
  "fields": {
    "token_id": [
      "extra keys not allowed"
    ]
  },
  "message": "Validation Error",
  "type": "invalid_request_error"
}" 
time="2016-10-23T22:02:25+02:00" level=debug msg="StatusCode: 400, Type: invalid_request_error, APIMessage: \x1b[31mValidation Error\x1b[0m, Details: map[token_id:[extra keys not allowed]]" 
time="2016-10-23T22:02:25+02:00" level=fatal msg="cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: \x1b[31mValidation Error\x1b[0m, Details: map[token_id:[extra keys not allowed]]" 

NB: i've deleted all my tokens before executing those commands.

I have the same issue with the same output.
I've even tried to login with --token= and --organization= but that doesn't work neither.

Stefan:~ Stefan$ scw -D -V login --token="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX" --organization="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX"
DEBU[0000] curl -X HEAD -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: 00000000-0000-4000-8000-000000000000" 'https://account.scaleway.com/tokens'
DEBU[0000] HEAD /tokens HTTP/1.1
Host: account.scaleway.com
Content-Type: application/json
User-Agent: scw/v1.9.0+dev
X-Auth-Token: XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX


DEBU[0000] curl -X GET -H "Content-Type: application/json" -H "User-Agent: scw/v1.9.0+dev" -H "X-Auth-Token: 00000000-0000-4000-8000-000000000000" 'https://account.scaleway.com/tokens?token_id=00000000-0000-4000-8000-000000000000'
DEBU[0000] GET /tokens?token_id=XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX HTTP/1.1
Host: account.scaleway.com
Content-Type: application/json
User-Agent: scw/v1.9.0+dev
X-Auth-Token: XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX


DEBU[0000] [Response]: [400]
{
  "fields": {
    "token_id": [
      "extra keys not allowed"
    ]
  },
  "message": "Validation Error",
  "type": "invalid_request_error"
}
DEBU[0000] StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]
FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

Note:
scw is freshly installed via brew install scaleway/scaleway/scw --HEAD

Hi, I released a new version with the fix, https://github.com/scaleway/scaleway-cli/releases/tag/v1.10

Let me know if you have any trouble with this version ☺️.

Hi @QuentinPerez, thanks for the quick response!

I've updated but with no luck:

Stefan:~ Stefan$ scw --version
scw version v1.10+dev, build homebrew

Stefan:~ Stefan$ scw login
Login (cloud.scaleway.com): XXXXX@XXXXX.XXX
Password:
FATA[0014] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

Stefan:~ Stefan$ scw login --token="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX" --organization="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX"
FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

Stefan:~ Stefan$

It looks to be the same error:

DEBU[0000] [Response]: [400]
{
  "fields": {
    "token_id": [
      "extra keys not allowed"
    ]
  },
  "message": "Validation Error",
  "type": "invalid_request_error"
}

Hi @legraphista
Can you download the CLI from the release page https://github.com/scaleway/scaleway-cli/releases/tag/v1.10 ?

My team and me can't reproduce your issue. 😑

@QuentinPerez, I'm sorry, still no luck 😢
I've downloaded the 1.10 version and this is the output
I've also double checked my tokens

Stefan:scw_1.10_darwin_amd64 Stefan$ ./scw --version
scw version v1.10, build 0f6843f

Stefan:scw_1.10_darwin_amd64 Stefan$ ./scw login --token="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX" --organization="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX"
FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

# I make an unintentional mistake in the password
Stefan:scw_1.10_darwin_amd64 Stefan$ ./scw login
Login (cloud.scaleway.com): XXXXXXXX@XXXXX.XX
Password:
FATA[0037] cannot execute 'login': [401] maybe your email or your password is not valid

Stefan:scw_1.10_darwin_amd64 Stefan$ ./scw login
Login (cloud.scaleway.com): XXXXXXXX@XXXXX.XX
Password:
FATA[0008] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

Stefan:scw_1.10_darwin_amd64 Stefan$ ./scw -D -V login --token="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX" --organization="XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX"
DEBU[0000] curl -X HEAD -H "Content-Type: application/json" -H "User-Agent: scw/v1.10" -H "X-Auth-Token: 00000000-0000-4000-8000-000000000000" 'https://account.scaleway.com/tokens'
DEBU[0000] HEAD /tokens HTTP/1.1
Host: account.scaleway.com
Content-Type: application/json
User-Agent: scw/v1.10
X-Auth-Token: XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX


DEBU[0000] curl -X GET -H "Content-Type: application/json" -H "User-Agent: scw/v1.10" -H "X-Auth-Token: 00000000-0000-4000-8000-000000000000" 'https://account.scaleway.com/tokens?token_id=00000000-0000-4000-8000-000000000000'
DEBU[0000] GET /tokens?token_id=XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX HTTP/1.1
Host: account.scaleway.com
Content-Type: application/json
User-Agent: scw/v1.10
X-Auth-Token: XXXXXXXX-XXXX-4XXX-9XXX-XXXXXXXXX


DEBU[0000] [Response]: [400]
{
  "fields": {
    "token_id": [
      "extra keys not allowed"
    ]
  },
  "message": "Validation Error",
  "type": "invalid_request_error"
}
DEBU[0000] StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]
FATA[0000] cannot execute 'login': Unable to contact ScalewayAPI: StatusCode: 400, Type: invalid_request_error, APIMessage: Validation Error, Details: map[token_id:[extra keys not allowed]]

Should be fixed on master, I will release a new version with the fix soon.

I released a new version v1.10.1 not available from brew, only from https://github.com/scaleway/scaleway-cli/releases/tag/v1.10.1

@QuentinPerez You can instal it via brew install scaleway/scaleway/scw --HEAD
That's how I got it just after the fix. You just have to make sure you've uninstalled the previous version.

With the v1.10.1 : You are now authenticated on Scaleway.com 👍