Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when I try to add a new users in UAA #249

Closed
jabrena opened this issue Oct 27, 2015 · 3 comments
Closed

Error when I try to add a new users in UAA #249

jabrena opened this issue Oct 27, 2015 · 3 comments

Comments

@jabrena
Copy link

jabrena commented Oct 27, 2015

Hi, I am trying to create an user using this documentation:
https://github.com/cloudfoundry/uaa/blob/master/docs/UAA-APIs.rst#create-a-user-post-users

and I have just created a method to do it:

Users.prototype.add = function (token_type, access_token) {
    "use strict";

    var url = this.UAA_API_URL + "/Users";

    console.log(url);
    var options = {
        method: 'POST',
        url: url,
        headers: {
            Accept: 'application/json',
            Authorization: token_type + ' ' + access_token
        }
    };

    return this.REST.request(options, "200", false);
};

When I execute the method, I receive the following error:

     Error: the string "{\"message\":\"Content type 'application/octet-stream' n
ot supported\",\"error\":\"scim\"}" was thrown, throw an Error :)

Do you have a Curl request to add an User in UAA. I would like to create a user in uaa to call later this method in CC API:
http://apidocs.cloudfoundry.org/222/users/creating_a_user.html

Does exist a UAA documentation in the way of CC API:
http://apidocs.cloudfoundry.org/222/

Many thanks in advance

Juan Antonio

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/106735138.

@jabrena
Copy link
Author

jabrena commented Oct 27, 2015

The url used is:

https://uaa.MY_IP.xip.io/Users

@jabrena
Copy link
Author

jabrena commented Oct 27, 2015

I have just updated the request adding some details from:
http://www.simplecloud.info/specs/draft-scim-api-01.html#create-resource

and now it runs, but I think that UAA has some problem with JSON response.
Node detect some problems with string returned, I think.

Users.prototype.add = function (token_type, access_token, uaa_options) {
    "use strict";

    var url = this.UAA_API_URL + "/Users";
    var options = {
        method: 'POST',
        url: url,
        headers: {
            Accept: 'application/json',          
            Authorization: token_type + ' ' + access_token
        },
        json: uaa_options
    };

    return this.REST.request(options, "201", false);
};

Test:

    it("The platform creates an User", function () {
        this.timeout(5000);

        var uaa_options = {
            "schemas":["urn:scim:schemas:core:1.0"],
            "userName":"demo4",
            "emails":[
                {
                  "value":"demo@example.com",
                  "type":"work"
                }
              ]
        };

        return CloudFoundryUsers.add(token_type, access_token, uaa_options).then(function (result) {
            console.log(result)
            expect(true).to.be.a('boolean');
        });
    });

FIXED.

@jabrena jabrena closed this as completed Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants