Server2Server Integration guide (BETA)
Requirements: User with an account on Ochno Operated
Create new integration
Login to Ochno Operated and navigate to Account(select an account)->Integrations->Custom Integrations->Create
Fill out the form - make sure the redirect uri is a valid endpoint on your system to handle the code query exchange (explained further down under “Code exchange authorisation”)
Scopes
sub - allows the user userId to be fetched on behalf of the user authorised on the application
email - allows the user email to be fetched on behalf of the user authorised on the application
hubs:read - allows hub/switch data to be read on behalf of the user authorised on the application
accounts:read - allows the accountinfo to be read on behalf of the user&account authorised on the application
When saved you can see it in the list of integrations. Click it to view it and see your autogenerated client_id & client_secret
Retrieving access
Step 1
With the authorisation code call the endpoint(post) https://operated.ochno.com/identity/oauth/v2/token
Parameters
client_id
client_secret
grant_type = ‘
client_credentials
’scope
- space separated string (spaces between scopes)
headers
"Content-Type" : "application/x-www-form-urlencoded"
In the response (if successfull) you will recieve the data object which contains
access_token (use this in header - Authorization : Bearer *access_token*)
refresh_token (use this to generate new access_tokens + refresh_tokens)
const response = await axios.post('https://operated.ochno.com/identity/oauth/v2/token', {
client_id: process.env.clientID,
client_secret: process.env.clientSecret,
grant_type: 'client_credentials',
scope: 'hubs:read hubs:write accounts:read'
},
{
headers : {
"Content-Type" : "application/x-www-form-urlencoded",
}
})
const access_token = response.data.access_token;
const refresh_token = response.data.refresh_token;
Step 2
You can now use the API endpoints to fetch data on behalf the account which the integration was created
Supply the access_token in each request - Authorization : Bearer *access_token*
Step 3
To generate new access_token & refresh_token
Endpoint https://operated.ochno.com/identity/oauth/v2/token (post)
Parameters
refresh_token
client_id
client_secret
grant_type = ‘refresh_token’
redirect_uri
headers
"Content-Type" : "application/x-www-form-urlencoded"
Swagger documentation
Related content
Ochno All Rights Reserved