Central Authorization Api Template


Description

This can be used to register for Central Auth. Registration API needs the following attributes: - username - Email of the user to be registered. Must be valid email format and unique. - name - Name of user - password - Password for user.

Headers
Key Value Description
Content-Type application/json
Body
{
"data":{
         "name":"roshan",
	      "email":"roshanr@ekbana.com",
           "password": "p@$$word"
        }

}
Response
Register Api Success Response | Code: 200
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "data": {
        "id": 8,
        "email": "roshanr@ekbana.com",
        "name": "roshan",
        "phone": null
    }
}
Response
Register Api Error Response | Code: 422
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "errors": [
        {
            "code": "code.email",
            "source": "pointer\":\"/data/attributes/email",
            "title": "The email has already been taken.",
            "detail": "The email has already been taken."
        }
    ]
}
Description

This can be used to login for Central Auth. Login API needs the following attributes: - username - Email of register user. - password - Password of user. - grant-type -Grant type must be Passwod. - client-id - client id of that related user . - client-secret - client secret of that related user .

Headers
Key Value Description
Content-Type application/json
Body
{
"data":{
         "username":"roshanr@ekbana.info",
         "password":"p@$$word",
         "grant-type":"password",
         "client-id":"1",
         "client-secret":"asdvw23423afdasdasdasd",
         "scope":"*"

        }
}
Response
Success Response | Code: 200
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "data": {
        "token_type": "Bearer",
        "expires_in": 31622400,
        "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjNhYzUyMmRjOWZiOTAwZDU4Y2QyOWYzMzUwNjg0ODdmNzAzZDhhMTU3MTdiOGEwYjI5M2Y3OTBmNWExOTE2NGEyZTdiZjM3MTJhMmI5NmI5In0.eyJhdWQiOiIxIiwianRpIjoiM2FjNTIyZGM5ZmI5MDBkNThjZDI5ZjMzNTA2ODQ4N2Y3MDNkOGExNTcxN2I4YTBiMjkzZjc5MGY1YTE5MTY0YTJlN2JmMzcxMmEyYjk2YjkiLCJpYXQiOjE1NjIyMjg5MDcsIm5iZiI6MTU2MjIyODkwNywiZXhwIjoxNTkzODUxMzA3LCJzdWIiOiI1Iiwic2NvcGVzIjpbIioiXX0.LAtfj1lwedRbTyPgP__dGDhCPLrqHfvWTY8efWm9qWXjhbYfiKDJpIK-az0USxF3McXg2DbbX3VBf7k5HD4bjKXe2GhlwPnb7a9_mDGrfh1pe5GmKEZvHThDvNeCimto2fo172w-FFUBJ_67l1lIc4gcXdhkvedjBr8rL2dgRkc4EBcQ4Q3Zl1ueCxVPAmVk2QM_abckwzrV-ctKjHGXebsznqVDkMuV9ylF9V9lzxyUS83lGz-RAU3QQxp4VKnodQZe7P0ix03VgP8CGbD24Nr2oBLvZdepKeBKatNm58m1-yZjzP_eGh9YIFHqL07ZfFvOv0D5_nxnN3Sz3Acb7FfFY9CcDfqgvOJhl-AJTakr2b9V9NzhgtuHFhR_7Q2C5vqoN0fRTLJByrThUCgVBsGAT9PN_9_zdPVUW-jUa1L7xRcx7kTCF2rVB6QbHZvqZleVHX3hhh737Gosc_Kij3CmP04aZVymSFfLUbPlNgGnSx2bHMb_-n1QmqoZ9yPwFiyU-58r4YI7yKNR1z1OgA4AUrwC1rIGewVlfmKUe5CEG4aSurSfzRHhF1SN9B1dUvRTCpzB8TwoKSN0iAKMGn-g_PyjDX7d3TPUJHSUlGfGNsVUYYb7tEqKJsBteUXvRtMgTyqtZ8ZU5AOaW7L1p6RyA0k9h9LYS2wXcyfinyA",
        "refresh_token": "def50200caeb7754167db70596af8ccd3a1613fdf1ceb404c696ac92f645a8c45472c6122fb093849cb746612fbfc162ac0f9ff50d02bc27198461a9ae73421045484f185e74c50652bdfd09e64dfa46dc6d64d0ee67ab38345514423cab3546a78fd8176167b76f18ec0728b61a8a9348f32a66146068a2b9d12e64da0235100615219ef0164b624f26fd5eb11d959c140adcecaf6cac83d827226308f60c7e4e5078b559b2128e67c8870245b39909098ea279e5a049d23b9ff159d1b66df41030bf9e29397a29e9d25e45f8398015b03e98136cc64987fd85f9bf0c3c924f9524384d2351d4044ed460f7dbf7dc8920458347084c7d683c9c726458479fe9412517910b95c3d1c100cd174b1cfa6e0c986f987bc4e043095ee803549d82076588458d6956f7ed22550ae53190cdc5f33fec4fdce4d422c65ab4a40b6e6a61f1c90cd914da17d30b66b2dd89ccf76e0ebfd0a10723e6c3246a60e0e4ed9df0a359573d"
    }
}
Response
Error Response | Code: 422
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "errors": [
        {
            "code": "code.invalid_credentials",
            "source": "pointer\":\"/data/attributes/invalid_credentials",
            "title": "The user credentials were incorrect.",
            "detail": "The user credentials were incorrect."
        }
    ]
}
Description

This can be used to forgot password for Central Auth.Forgot Password API needs the following attributes: - email - Email of the user that is registered. Must be valid email format.

Headers
Key Value Description
Content-Type application/json
Body
{
"data":{
         "email":"roshanr@ekbana.com"
        }
}
Response
Forgot Password Success Response | Code: 0
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "data": {
        "id": 8,
        "email": "roshanr@ekbana.com",
        "name": "ram",
        "phone": null
    }
}
Response
Forgot Password Error Response | Code: 422
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "errors": [
        {
            "code": "code.email",
            "source": "pointer\":\"/data/attributes/email",
            "title": "The email field is required.",
            "detail": "The email field is required."
        }
    ]
}
Description

This can be used to Reset password for logged in user for Central Auth.Reset Password API needs the following attributes: - authorization -Bearer token of that login user. -old-password -Old password of that user. - new-password -New Password of that user.

Headers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ol-vmAedA2lxRN2sM4hv2EUTyOoyDDs
Body
{
"data":{
         "old-password":"p@$$word",
         "new-password":"newp@$$word"
        }
}
Response
Reset password for logged in User Success Response | Code: 200
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "data": {
        "id": 5,
        "email": "roshanr@ekbana.com",
        "name": "test",
        "phone": "9840023065"
    }
}
Response
Reset password for logged in user Error Response | Code: 422
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "errors": [
        {
            "source": "pointer\":\"/data/attributes/password",
            "code": "code.password",
            "title": "Password didn't matched",
            "detail": "Password didn't matched"
        }
    ]
}
Description

This can be used to Set Password From forgot password token for Central Auth.Set Password from forgot password token API needs the following attributes: - token -Token of the user. - password -New Password of the user .

Headers
Key Value Description
Content-Type application/json
Authorization
Body
{
"data":{
         "token":"12Asdq",
         "password":"test123"
        }
}
Response
Set Password from forgot password token Sucess Response | Code: 200
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "data": {
        "id": 5,
        "email": "roshanr@ekbana.com",
        "name": "test",
        "phone": "9840023065"
    }
}
Response
Set Password from forgot password token Error Response | Code: 422
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "errors": [
        {
            "source": "pointer\":\"/data/attributes/token",
            "code": "code.unauthenticated",
            "title": "Invalid token provided",
            "detail": "Invalid token provided"
        }
    ]
}
Description

This can be used For User Profile for Central Auth. Profile API needs the following attributes: - authorization -Bearer token of that login user.

Headers
Key Value Description
Content-Type application/json
Authorization Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0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"Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "data": {
        "id": 5,
        "email": "roshanr@ekbana.com",
        "name": "test",
        "phone": "9840023065"
    }
}
Response
Get profile Error Response | Code: 401
{
    "meta": {
        "copyright": "Copyright 2017 Ekbana Pte",
        "emails": "ekbana@info.com,roshanr@ekbana.com",
        "api": {
            "version": "0.2"
        }
    },
    "errors": [
        {
            "source": "pointer\":\"/data/attributes/unauthenticated",
            "code": "code.unauthenticated",
            "title": "Unauthenticated",
            "detail": "Unauthenticated"
        }
    ]
}