Bot Authorization
After created a bot profile, you’ll also need to provide a random string generated from Admin Panel to use for OAuth service. After the authentication succeeds an access token will be provided.
On node.JS, the authentication algorithm looks like this
const ClientOAuth2 = require('client-oauth2');
const ekoAuth = new ClientOAuth2({
clientId: process.env.EKO_OAUTH_CLIENT_ID,
clientSecret: process.env.EKO_OAUTH_CLIENT_SECRET,
accessTokenUri: `${process.env.EKO_HTTP_URI}/oauth/token`, //Eko HTTP server uri
scopes: ['bot'],
});
const authenticate = async () => {
const { data } = await ekoAuth.credentials.getToken();
app.set('token', data); //returned access token
};OAuth Parameter
Name
Type
Description
clientId
String
Random string specific to bot
clientSecret
String
Random string specific to bot
accessTokenUri
String
Eko http server uri
Response
cURL
Add the access token to your request
Last updated