Skip to content
This repository was archived by the owner on Jul 24, 2021. It is now read-only.

Commit fec6139

Browse files
document how to generate credentials in the local database for testing purposes
1 parent 3f4674e commit fec6139

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,26 @@ including database connectivity information.
6666

6767
* `make run`
6868

69+
## Creating Local Credentials
70+
71+
First, you need to get a login token into the local database. We can do this by leveraging the
72+
knowledge that an encrypted password entry of `''` will match against all supplied inputs:
73+
74+
$ psql -U conch conch --command="insert into user_account (name, password, email) values ('me', '', 'your_email@joyent.com')"
75+
76+
Now, we use this email and password to generate a login token:
77+
78+
make run
79+
curl -i -H'Content-Type: application/json' --url http://127.0.0.1:5001/login -d '{"email":"your_email@joyent.com","password":"anything"}'
80+
81+
You will see output like this:
82+
83+
{"jwt_token":"eyJInR5cCI6Iwhargarbl.eyJl9pZCI6ImM1MGYwhargarbl.WV3uJEvg0bqInI9pEtl04ZZ8ECN4yQOSmehello"}
84+
85+
Save that token somewhere, such as in an environment variable or a file, for use in future API calls. You will include it in the "Authorization" header, for example:
86+
87+
curl -i --url https://staging.conch.joyent.us/user/me --header "Authorization: Bearer eyJInR5cCI6Iwhargarbl.eyJl9pZCI6ImM1MGYwhargarbl.WV3uJEvg0bqInI9pEtl04ZZ8ECN4yQOSmehello"
88+
6989
## Docker
7090

7191
### Compose

0 commit comments

Comments
 (0)