Get Authorized
GraphGrid's API uses Basic Auth and OAuth 2.0. To get an OAuth token, you first need to request Basic Auth.
Basic Auth
As an added security measure GraphGrid requires client credentials containing a CLIENT_ID
and a CLIENT_SECRET
to grant
basic auth. Client credentials are configurable, but you can use the default values instead:
'CLIENT_ID': 'a3847750f486bd931de26c6e683b1dc4'
'CLIENT_SECRET': '81a62cea53883f4a163a96355d47656e'
You can manually generate the authorization header in a terminal using the default client credentials:
echo -n 'a3847750f486bd931de26c6e683b1dc4:81a62cea53883f4a163a96355d47656e'| base64
After generating our encoded client credentials the full Basic Auth header will look like this:
Authorization: Basic YTM4NDc3NTBmNDg2YmQ5MzFkZTI2YzZlNjgzYjFkYzQ6ODFhNjJjZWE1Mzg4M2Y0YTE2M2E5NjM1NWQ0NzY1NmU=
Default username: graphgrid
Default password: graphgrid
Now we can request an OAuth access token running this request:
curl --location --request POST "${API_BASE}/1.0/security/oauth/token" \
--header "Authorization: Basic YTM4NDc3NTBmNDg2YmQ5MzFkZTI2YzZlNjgzYjFkYzQ6ODFhNjJjZWE1Mzg4M2Y0YTE2M2E5NjM1NWQ0NzY1NmU=
" \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=graphgrid' \
--data-urlencode 'password=graphgrid'
Parameters
Key | Value | Description |
---|---|---|
grant_type | Either password or client_credentials | The grant type should be either client_credentials if authing for a client, or password if for a user |
username | Username | The user username. Required if password is selected as grant_type above. |
password | Password | The user password. Required if password is selected as grant_type above. |
scope | all | Which OAuth scopes to request. Only all is available right now. |
superadmin
password this request will return your user grn as well as your authtoken. Both of which you will need to update your password
After we've gotten our OAuth token, we can access the GraphGrid API and get started using GraphGrid Security!
Create User
To create a user account simply pass in the user's first and last name, email, username and password to this request:
curl --location --request POST "${API_BASE}/1.0/security/user/new?signIn=false&skipAllNotificationEmails=false" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--data-raw '{
"firstName": "Graph",
"lastName": "Master",
"email": "GraphsRLife@graphgrid.test",
"username": "GraphMaster",
"password": "12345678",
"role": 2
}'