External code authentication issue

I made a test application to write and read data using the COT generated model.
When it was without membership active all was fine, but now I have this error:

Not authorized to access private view 'myview' in data controller

How to authenticate from external asp.net application?

Thanks
1 person has
this question
+1
Reply
  • giuseppe,

    You can either use Basic authentication to submit the username and password, or call the ~/_invoke/Login API with JSON like below:

    {
    "username": "admin",
    "password": "admin123%",
    "createPersistentCookie": true
    }


    It will return a response like below:

    {
    "d": {
    "UserName": "admin",
    "Email": "admin@MyCompany.com",
    "Token": "615E7BE8AB11F0D408F9D2171803ACA52EFA149BB238DDD64A6CAC7DD5F9F6B6078F00A8A2A5FC9D0045C0D7DB2A1CBDE60D966E2A84B801ECDFD46FD924CFA90ADA93C80A1A0F0E215173626B53DB0DB04440E2350C5895E9B911D0D5B0B8DAD70ADE9FAA5DB4803F0764A4C7E891D65E13BAF6988CD9AA5BBFBD28F711CA46",
    "Picture": "",
    "Claims": {}
    }
    }


    You can then use the Token property in a Bearer authentication:

    Authorization: Bearer 615E7BE8AB11F0D408F9D2171803ACA52EFA149BB238DDD64A6CAC7DD5F9F6B6078F00A8A2A5FC9D0045C0D7DB2A1CBDE60D966E2A84B801ECDFD46FD924CFA90ADA93C80A1A0F0E215173626B53DB0DB04440E2350C5895E9B911D0D5B0B8DAD70ADE9FAA5DB4803F0764A4C7E891D65E13BAF6988CD9AA5BBFBD28F711CA46
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated

  • Good night. I am using version 8.7.14 and I have the same problem, even using createPersistentCookie.

    Do I need to enable any parameters?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. indifferent, undecided, unconcerned happy, confident, thankful, excited kidding, amused, unsure, silly sad, anxious, confused, frustrated