Configuring OAuth 1.0 authentication using config file

Configuring OAuth 1.0 authentication using config file


Go to http://localhost:5986/_utils and find section httpd(not chttpd), there change value of field bind from 127.0.0.1 to 0.0.0.0

Close Admin Party, by creating database admin.

curl -X PUT http://172.17.0.1:5986/_config/admins/admin -d '"supersecret"'
There is admin is username and "supersecret" is password, it is writing to config section admins. In feature posts I will show how to create users in database _users
All correct responses from couchdb after writing to config file looks like this(don't know why not :ok):
""

We need to generate four digests:

Execute next command four times:

< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-2048} |  sha256sum

and you will get four SHA256 digests

Consumer key:     "6ab4ddd1ce65f6381cef17e0fbfefd66757440488530275fc085b51edb06f834",
Consumer secret:  "a723486eaaac5906a834b19881961a36865f43aa560b8d5877ace1d771e6ddd4",
Token:                   "f4e4ef1e10be83fa872c24cd52f116671c9da29dc54273caa2b22190d2df9712",
Token secret:         "d45c84d26c56af1e02ea20e400c4f78e90c3caa1f9600e20199f8418112b9260"

So let's send required configuration requests:

Create consumer key and secret
curl -X PUT http://admin:supersecret@172.17.0.1:5986/_config/oauth_consumer_secrets/6ab4ddd1ce65f6381cef17e0fbfefd66757440488530275fc085b51edb06f834 -d '"a723486eaaac5906a834b19881961a36865f43aa560b8d5877ace1d771e6ddd4"'
Create consumers token and secret:
curl -X PUT http://admin:supersecret@172.17.0.1:5986/_config/oauth_token_secrets/f4e4ef1e10be83fa872c24cd52f116671c9da29dc54273caa2b22190d2df9712 -d '"d45c84d26c56af1e02ea20e400c4f78e90c3caa1f9600e20199f8418112b9260"'
Map token to our admin:
curl -X PUT http://admin:supersecret@172.17.0.1:5986/_config/oauth_token_users/f4e4ef1e10be83fa872c24cd52f116671c9da29dc54273caa2b22190d2df9712 -d '"admin"'


OAuth configured.

Comments

Popular Posts