Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)
Cloudera Employee

Here is a self explanatory tutorial. The official Cloudbreak documentation explains how to retrieve your Cloudbreak token via curl or python (see here).

I have been playing with Node.JS on my side, so here is how to do it in Node.JS using request:

process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;

var request = require("request");

var options = { method: 'POST',
  url: 'https://[YOUR_CB_URL]/identity/oauth/authorize',
  qs: 
   { response_type: 'token',
     client_id: 'cloudbreak_shell',
     'scope.0': 'openid',
     source: 'login',
     redirect_uri: 'http://cloudbreak.shell',
     accept: 'application/x-www-form-urlencoded' },
  headers: 
   { 'Content-Type': 'application/x-www-form-urlencoded',
     accept: 'application/x-www-form-urlencoded' },
     body: 'credentials={"username":"[YOUR_USER]","password":"[YOUR_PASSWORD]"' };

request(options, function (error, response, body) {
  if (error) throw new Error(error);
  const querystring = require('querystring');

  console.log(querystring.parse(response.headers['location'])['access_token']);
});
238 Views
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎01-17-2019 06:10 PM
Updated by:
 
Contributors
Top Kudoed Authors