Developping our own, independant dev portal

Hi there,

I put my hands on the jade templates for the customization of a dev portal this morning. The CMS approach slows the integration into our global monetization logic. I would prefer coding an independant frontend, that would be not handled by the tyk dashboard.

Do the different APIs of tyk-dashboard would allow me to validate a login/password and get the corresponding user id, organisation id, api keys ? I did find answers of how to manage keys, policies, user profile etc. using the tyk APIs as soon as I get those basics info, but I did not find how to get them from an independant website (that would be our custom dev portal).

Is tyk allow that kind of thing ? How could we do that ?

Thank you from your help,
Xavier

Hi Xavier,

yes, since all the dashboard and portal operations are DB based you can built your custom dev portal.

Thanks,

Kos @ Tyk Support Team

If you want to take flows from the portal, you can integrated with them via API - you integrate against the Dashboard API, not the gateway API.

Hope that helps.

Hi Kos, Hi James,

Thanks for your quick anwsers.

I may have poorly worded my request.

In brief : I know that we can do everything the dashboard does thanks to the Tyk APIs. Everything seems to be in the Tyk Rest Api, Tyk dashboard API and Dashboard admin API docs, except how to manage developper connexions from outside Tyk.

I imagine something like a http POST to a Tyk endpoint with a dev login / password from my web app (our external dev portal), and in case of success, get its id, organisation id etc. Then I would be able to manage everything concerning his account with the Tyk APIs (from the web app).

Do I have to write my own auth service ? If yes, should It use the Tyk /api/portal/developers endpoint ? Direct mongodb query ?

Thank you in advance for your precious help,
Xavier

Hi everybody,

No answer that could help us ?

Thanks,
Xavier

Hi xador,

you could try to POST but we do suggest to use the DB (Mongo) directly as it will give you more control.

Thanks,

Kos @ Tyk Support Team

Ok, thanks.

It may be trivial, but for people like me that are not used to work with mongodb, here is an example of a login webservices for tyk analytics in php (using the mongodb driver) :

<?php
use MongoDB\Driver as MongoDB;

$login = @$_POST['login'];
$password = @$_POST['password'];

if(empty($login) || empty($password)) {
    return http_response_code(400);
}

$manager = new MongoDB\Manager('mongodb://localhost:27017');

$query = new MongoDB\Query(['email' => $login], []);
$cursor = $manager->executeQuery('tyk_analytics.portal_developers', $query);

$dev = $cursor->toArray();
if(empty($dev)) {
    return http_response_code(400);
}

$dev = $dev[0];
$loggued = password_verify($password, $dev->password);

if($loggued == false) {
    return http_response_code(401);
}

$res = array(
    'id' => (string) $dev->_id,
    'orgId' => $dev->org_id    
);

header('Content-Type: application/json');
echo json_encode($res);

Xavier