Skip to content

Instantly share code, notes, and snippets.

@asoorm
Last active June 18, 2020 07:46
Show Gist options
  • Save asoorm/7a139d0a28bb514d90ad61e69f1796cc to your computer and use it in GitHub Desktop.
Save asoorm/7a139d0a28bb514d90ad61e69f1796cc to your computer and use it in GitHub Desktop.
  1. Using dashboard admin api - get the organisations, and look for the organisation id: in this example, org is is 5bcef48a3f03d311ff27d156.
curl -s http://dashboard.tyk:3000/admin/organisations -H 'Admin-Auth: 12345' | python -mjson.tool
{
    "organisations": [
        {
            "apis": [],
            "cname": "portal.tyk:3000",
            "cname_enabled": true,
            "developer_count": 1,
            "developer_quota": 0,
            "event_options": {},
            "hybrid_enabled": false,
            "id": "5bcef48a3f03d311ff27d156",
            "org_options_meta": {},
            "owner_name": "Tyk Technologies",
            "owner_slug": "default",
            "ui": {
                "cloud": false,
                "default_lang": "",
                "designer": {},
                "dont_allow_license_management": false,
                "dont_allow_license_management_view": false,
                "dont_show_admin_sockets": false,
                "hide_help": false,
                "languages": {},
                "login_page": {},
                "nav": {},
                "portal_section": {},
                "uptime": {}
            }
        }
    ],
    "pages": 0
}
  1. Create a new admin user, replacing "org_id": "5bcef48a3f03d311ff27d156" with your own org id.
curl -s http://dashboard.tyk:3000/admin/users -H 'Admin-Auth: 12345' -d '{"first_name": "John", "last_name": "Smith", "email_address": "foo@bar.com", "active": true, "password": "newpass", "user_permissions": { "IsAdmin": "admin" }, "org_id": "5bcef48a3f03d311ff27d156"}' | python -mjson.tool
{
    "Message": "f35f51e61f58479270600135f30a54e9",
    "Meta": {
        "access_key": "f35f51e61f58479270600135f30a54e9",
        "active": true,
        "api_model": {},
        "email_address": "foo@bar.com",
        "first_name": "John",
        "group_id": "",
        "id": "5bd7041ea3d9f6985587e8f1",
        "last_name": "Smith",
        "org_id": "5bcef48a3f03d311ff27d156",
        "user_permissions": {
            "IsAdmin": "admin"
        }
    },
    "Status": "OK"
}
  1. Reset the new user's password using the dashboard API. You will need the user's id and their access_key from the previous response:
curl -s http://dashboard.ahmet:3000/api/users/5bd7041ea3d9f6985587e8f1/actions/reset -H 'Authorization: f35f51e61f58479270600135f30a54e9' -d '{"new_password": "testpass"}' | python -mjson.tool

{"Status":"OK","Message":"User password updated","Meta":null}
  1. You should now be able to log in via the dashboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment