0

I'm using sails.js and Atlassian-crowd-client package to authenticate in crowd. but it returns the error of: Error: Invalid Response from Crowd, expecting JSON. here are my codes and I don't know where the problem is. I'll be thankful if anybody helps.

var atlassianCrowdClient = require('atlassian-crowd-client');
var crowd = new atlassianCrowdClient({
  baseUrl: 'http://my-host/crowd/console/login.action',
  application: {
    name: 'app-name',
    password: 'app-password'
  },
  "Content-Type":"application/json",
  "Accept": "application/json"
});

module.exports = {            
  show: function (req, res) {crowd.session.create({'username':'my-username','password':'my-password'})
    .then(function (session) {
      console.log('Crowd SSO token is ' + session.token);
    })
    .catch(function(err) {
        console.log('err: ' + err)
    })

  }

};
fariba.j
  • 1,737
  • 7
  • 23
  • 42

1 Answers1

0

I think the baseURL you are using is wrong. It should be

baseUrl: 'https://crowd.example.com/'

see here: https://www.npmjs.com/package/atlassian-crowd-client

Markus
  • 1,887
  • 18
  • 23