Active Collab v5 issue-token API call returns “invalid password” even though password is valid

岁酱吖の 提交于 2019-12-07 12:01:13

问题


I am trying to obtain an API Token via this call:

curl -H "Content-Type: application/json" -X POST -d '{"username": "MY_EMAIL","password": "MY_PWD","client_name": "XXX","client_vendor": "XXX"}' https://app.activecollab.com/MY_ID/api/v1/issue-token

But I am receiving this response even though the password is correct:

{
    "type":"ApiSubscriptionError",
    "message":"Invalid password",
    "code":3
}

I am following the instructions at https://labs.activecollab.com/nightly-activecollab-api/v1/authentication.html

Is anyone able to use the Active Collab v5 API OK? If so, can you help spot the trouble?


回答1:


Authentication is done in two steps. First one is to authenticate to main authentication service (https://activecollab.com):

curl -XPOST -d 'email=user@example.com&password=******' https://activecollab.com/api/v1/external/login

This call will return a list of accounts that authenticated user has access to, as well as user details:

{
    "is_ok": true,
    "accounts": [
        {
            "class": "FeatherApplicationInstance",
            "display_name": "Company Name (ID: #ACCOUNT_ID#)",
            "name": 1,
            "url": "https://app.activecollab.com/#ACCOUNT_ID#"
        }
    ],
    "user": {
        "avatar_url": "https://activecollab.com/avatars/user_#USER_ID#.png",
        "first_name": "John",
        "last_name": "Doe",
        "intent": "long string"
    }
}

Among user properties there's intent property. It is used to authenticate agains a particular Active Collab 5 accounts, like this:

curl -XPOST -d 'intent=LONG-INTENT-STRING-HERE&client_name=AppName&client_vendor=AppVendor' https://app.activecollab.com/#ACCOUNT_ID#/api/v1/issue-token-intent

Client vendor and client name are names of your organisation, and name of your app. This call will return a token that you can use to make further API calls in that account:

curl -H "X-Angie-AuthApiToken: TOKEN-HERE" https://app.activecollab.com/#ACCOUNT_ID#/api/v1/projects



回答2:


An activeCollab support person has provided me the info I needed. To get a token for my cloud account, I had to follow different documentation: https://gist.github.com/malizmaj/e04207c7712ba9f65fb7

I was not able to find that documentation on my own via googling.

Would be nice if the documentation at https://labs.activecollab.com/nightly-activecollab-api/v1/authentication.html mentioned it was only for non-cloud accounts!

Anyway, I am now able to make API calls to my cloud account ok!



来源:https://stackoverflow.com/questions/34664042/active-collab-v5-issue-token-api-call-returns-invalid-password-even-though-pas

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!