geosolutions-it / C195-azure-workspace

1 stars 2 forks source link

Manage CKAN API token #22

Open etj opened 3 years ago

etj commented 3 years ago

Since CKAN 2.9 the APIkey is discouraged and its use willb e removed in a future version. The new auth method for API is through API token, which can be multiple, and can be revoked one at time if needed.

They can be generated from the command line using the syntax:

ckan -c CONFIG_FILE user token add USERNAME TOKENNAME

E.g.:

(creaa) $ Q=$(ckan -c ../etc/ckan.ini user token add test03 test_token3)
2021-04-02 11:59:20,265 INFO  [ckan.cli] Using configuration file /mnt/ssd2/homeext/geosol/prj/crea_run/etc/ckan.ini
2021-04-02 11:59:20,265 INFO  [ckan.config.environment] Loading static files from public
2021-04-02 11:59:20,285 INFO  [ckan.config.environment] Loading templates from /mnt/ssd2/homeext/geosol/prj/crea_run/ckan/ckan/templates
2021-04-02 11:59:20,441 INFO  [ckan.config.environment] Loading templates from /mnt/ssd2/homeext/geosol/prj/crea_run/ckan/ckan/templates
(creaa) $ echo $Q
API Token created: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJKX2F1TlJiNnBRbEI2T2ZsOW5nM1hHcHlkWl90LWNRRk5rSG1NZUM1SVE2dDNJa203XzBoOHJJRm9sRGJIUEM5OFZuS0Y2dzl0ZEZQS0h1ciIsImlhdCI6MTYxNzM1NzU2MH0.eyAcjYJqwJqXYinJJhNGTFRZkwNfoeXCi-tXHJ2M79s
(creaa) $ echo ${Q#API Token created:*}
eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJqdGkiOiJKX2F1TlJiNnBRbEI2T2ZsOW5nM1hHcHlkWl90LWNRRk5rSG1NZUM1SVE2dDNJa203XzBoOHJJRm9sRGJIUEM5OFZuS0Y2dzl0ZEZQS0h1ciIsImlhdCI6MTYxNzM1NzU2MH0.eyAcjYJqwJqXYinJJhNGTFRZkwNfoeXCi-tXHJ2M79s
(creaa) $
randomorder commented 2 years ago

can we close this one @etj ?