{"_id":"56b37f2f0fb3582100572f4d","category":{"_id":"569d7eacec29360d00f667c9","__v":7,"pages":["56af94bd3c70b01700faced3","56af9532b34d210d003d9b4d","56af95bbaef9a21700da0df0","56b1970d7ae4550d0006287f","56b37f2f0fb3582100572f4d","56e1a0f81c99a22900dfd3b8","56e1a164cef5d822005291d6"],"project":"56439dfe9eebf70d00490d54","version":"56439dff9eebf70d00490d57","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-19T00:09:16.715Z","from_sync":false,"order":1,"slug":"authentication","title":"Authentication"},"parentDoc":null,"user":"55dd6b48a649eb170083b97a","__v":5,"githubsync":"","project":"56439dfe9eebf70d00490d54","version":{"_id":"56439dff9eebf70d00490d57","project":"56439dfe9eebf70d00490d54","__v":26,"createdAt":"2015-11-11T19:58:55.144Z","releaseDate":"2015-11-11T19:58:55.144Z","categories":["56439dff9eebf70d00490d58","56439e17c92c470d002dec71","564ce88e802cd02100444274","564d07ff3657c43500bf1d33","564d0a312da1982d00b19b64","564d2aa92da1982d00b19b8c","564d30a8b88a37210082253e","564d362c2da1982d00b19ba0","569d664371e3650d00acf018","569d7eacec29360d00f667c9","569d8006ec29360d00f667cb","569d855e0306a10d00ce99b9","569d91d571e3650d00acf04c","569d91eeceb7510d00f2a6a3","569e8c262d320817003b806d","569e8f802d320817003b8072","56b038c914dfea0d0007cf05","5717b4f0681bb41900fc575a","5718e0a4cd483219007c2c9a","571924c8e967cb1700d078e9","571e2648edc4a92b00a4cc65","576a677a6f15260e001f899b","576c5eaf5738570e00ff070f","578d127ed9c55c2000d4f213","579f90927ebe9b0e00059c50","582c0af888708a0f00570a69"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":false,"codename":"","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-04T16:41:19.068Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"examples":{"codes":[{"code":"{\n    \"client_key\" : \"c2hlZWJhbkBnb29ydWxlYXJuaW5nLm9yZw==\", \n    \"client_id\" : \"ba956a97-ae15-11e5-a302-f8a963065976\", \n    \"grant_type\" : \"credential\"\n}","language":"json"}]},"method":"post","results":{"codes":[{"name":"","code":"{\n  \"user_id\": \"aada6abc-eb11-4550-981f-3a36a53b4907\",\n  \"username\": \"rnfu34p13\",\n  \"client_id\": \"ba956a97-ae15-11e5-a302-f8a963065976\",\n  \"provided_at\": 1453472820207,\n  \"prefs\": {\n    \"taxonomy\": [\n      {\n        \"standard_framework_code\": \"CSS\",\n        \"default_subject_code\": \"GUT.M\"\n      }\n    ]\n  },\n  \"cdn_urls\": {\n    \"profile.cdn\": \"//profile.gooru.org.com\"\n  },\n  \"access_token\": \"YWFkYTZhYmMtZWIxMS00NTUwLTk4MWYtM2EzNmE1M2I0OTA3OkZyaSBKYW4gMjIgMTk6NTc6MDAgSVNUIDIwMTY6MTQ1MzQ3MjgyMDIwNw==\"\n}","language":"json","status":200}]},"settings":"570423d459c5190e000ab6c0","auth":"required","params":[],"url":"/token"},"isReference":false,"order":2,"body":"[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Authentication required\",\n  \"body\": \"client id,key and account  credential \\nHeader: Authorization: \\\"Basic base64(username:password)\\\"\"\n}\n[/block]\nThis is the only API which provides an access token in exchange for credentials. Note that all other APIs require authentication. This access token could be used to handle not logged in users. The moment user decides to log in, a new session token would be created for the users and this token needs to be used for all the operations going forward.\n\nYou might wonder where to place the username or email and password in order to authenticate. The answer is: In the request headers.\n\nIn order to authenticate with user credentials the previously mentioned json payload must have a header called: \"Authorization\" whose value must be the \"Basic\" + the result of encoding in Base64 the following string:\n\n\"username:password\"\n\nSo in the end the Header would look something like this:\n\n\"Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=\"\n\nYou can use the following link to understand Base64 encoding: [https://www.base64encode.org/](https://www.base64encode.org/)\n\nPlace close attention to the resulting \"access token\" as it must be used in the header of all other requests in the future. However on subsuquent requests to other endpoints, the header key value will be named \"Token\".","excerpt":"Generate authenticate user  access  token using client id, key and account credentials.","slug":"generate-authenticate-user-access-token-2","type":"endpoint","title":"Login"}

postLogin

Generate authenticate user access token using client id, key and account credentials.

Definition

{{ api_url }}{{ page_api_url }}

Examples


Result Format


Documentation

[block:callout] { "type": "info", "title": "Authentication required", "body": "client id,key and account credential \nHeader: Authorization: \"Basic base64(username:password)\"" } [/block] This is the only API which provides an access token in exchange for credentials. Note that all other APIs require authentication. This access token could be used to handle not logged in users. The moment user decides to log in, a new session token would be created for the users and this token needs to be used for all the operations going forward. You might wonder where to place the username or email and password in order to authenticate. The answer is: In the request headers. In order to authenticate with user credentials the previously mentioned json payload must have a header called: "Authorization" whose value must be the "Basic" + the result of encoding in Base64 the following string: "username:password" So in the end the Header would look something like this: "Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=" You can use the following link to understand Base64 encoding: [https://www.base64encode.org/](https://www.base64encode.org/) Place close attention to the resulting "access token" as it must be used in the header of all other requests in the future. However on subsuquent requests to other endpoints, the header key value will be named "Token".

User Information

Try It Out

post
{{ tryResults.results }}
Method{{ tryResults.method }}
Request Headers
{{ tryResults.requestHeaders }}
URL{{ tryResults.url }}
Request Data
{{ tryResults.data }}
Status
Response Headers
{{ tryResults.responseHeaders }}