__________     __ __     __  _______    ________
  / ____/ __ \   / // /    / / / /  _/ |  / / ____/
 / / __/ / / /  / // /_   / /_/ // / | | / / __/
/ /_/ / /_/ /  /__  __/  / __  // /  | |/ / /___
\____/\____/     /_/    /_/ /_/___/  |___/_____/

 --- A GOPHER-LIKE INTERFACE FOR HIVE BLOCKCHAIN ---

Bash script - challenge [part 3]. Authentication test (token) using the curl program.

BY: @grzesiekb | CREATED: March 19, 2020, 7:52 a.m. | VOTES: 13 | PAYOUT: $0.09 | [ VOTE ]

Medium level.

Requires:
1. An account on auth0.
2. The curl program to be installed.
3. Basic knowledge of Linux commands.

We need API to test (e.g. https://auth0.com).

Let’s go to API on auth0. (APIs->Settings->Test). Create & AUTHORIZE TEST APPLICATION

[IMAGE: https://cdn.steemitimages.com/DQmTZ2RKNByAZktbo9AZZxF7FeLsGoPAVEqsXL51CN7Bsay/image1.png]

Create & AUTHORIZE TEST APPLICATION

[IMAGE: https://cdn.steemitimages.com/DQmaFXmwP34Y6M9Q1FqCGS2oJb7j6cRTSQjpRwfZmRK2P3M/image3.png]

Get access_token

curl --request POST \
  --url https://dev-o1btb-69.eu.auth0.com/oauth/token \
  --header 'content-type: application/json' \
  --data '{"client_id":"tPOxbJ8QEMj8VVZEHPHt7uTM0uAHPd4v","client_secret":"xppOcAF8mqzRvZo9EBfPjIVZzdlfHPiVDyXwsOv1NL-Wx-4IKSMh3wwZllxtgZPF","audience":"https://dev-o1btb-69.eu.auth0.com/api/v2/","grant_type":"client_credentials"}'

And next try to authenticate in test using the curl program.

curl --request GET \
  --url https://dev-o1btb-69.eu.auth0.com/api/v2/ \
  --header 'authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik5VSXdOalV4UWtJMVJFUkJOREJHUlVZME5qUXhRak0yTWprMFF6Y3lNVGt5TmpWQ1JFUXhNUSJ9.eyJpc3MiOiJodHRwczovL2Rldi1vMWJ0Yi02OS5ldS5hdXRoMC5jb20vIiwic3ViIjoidFBPeGJKOFFFTWo4VlZaRUhQSHQ3dVRNMHVBSFBkNHZAY2xpZW50cyIsImF1ZCI6Imh0dHBzOi8vZGV2LW8xYnRiLTY5LmV1LmF1dGgwLmNvbS9hcGkvdjIvIiwiaWF0IjoxNTgzNTA5NTE3LCJleHAiOjE1ODM1OTU5MTcsImF6cCI6InRQT3hiSjhRRU1qOFZWWkVIUEh0N3VUTTB1QUhQZDR2IiwiZ3R5IjoiY2xpZW50LWNyZWRlbnRpYWxzIn0.eRWje68f11VgEO3mdZ3O-ICIVWlJNAhWx3JOF5-qzNILG9ZGWJ7zMQjUHAKQA0GkxRhWNcwFXpVeNuDwDUcb0IMFmaLfXCpvufcH0Pp_OtGw06iivlZwIjEEmstDUw8CU1gXiIImOOfI8FydrGft33ktkRKr0AN9pxcGUP-LanoaVRC2Lxoa5aNHAiThYk-kAT78-emUBdGG4cE_vGp7psH7BoDgLB7BxKkUgfQV1zAw-rLmXAYq-0h8oqrLZgkEQRCkOpHXa07Ls1W2N754EQbD8z6QuyHcbeicUQmVah_oNkc45v7Qv2r3sqX0BxSIy58OC5ocDWXJ24qd0yZ7eQ’

The next topic will be Reporting test results written using bash script.

Table of contents:

[Start] - Writing API tests using the curl program
[part 2] - Authentication test (session) using the curl program.

TAGS: [ #bash ] [ #test ] [ #curl ]

Replies

@innerhive | March 19, 2020, 7:52 a.m. | Votes: 0 | [ VOTE ]

https://i.imgur.com/CBqCEo5.pngJoin the community in our migration to Hive, a community built blockchain for the community. All Steem account holders will receive equivalent stake on the new Hive blockchain.Please see this post on SteemPeak for more information.

[ BACK TO TRENDING ] [ BACK TO MENU ]
CMD>