{"_id":"5864d2e079ce642d00f0ff22","version":{"_id":"5864d2df79ce642d00f0fec7","project":"56439dfe9eebf70d00490d54","__v":4,"createdAt":"2016-12-29T09:09:51.074Z","releaseDate":"2016-12-29T09:09:51.074Z","categories":["5864d2df79ce642d00f0fec8","5864d2df79ce642d00f0fec9","5864d2df79ce642d00f0feca","5864d2df79ce642d00f0fecb","5864d2df79ce642d00f0fecc","5864d2df79ce642d00f0fecd","5864d2df79ce642d00f0fece","5864d2df79ce642d00f0fecf","5864d2df79ce642d00f0fed0","5864d2df79ce642d00f0fed1","5864d2df79ce642d00f0fed2","5864d2df79ce642d00f0fed3","5864d2df79ce642d00f0fed4","5864d2df79ce642d00f0fed5","5864d2df79ce642d00f0fed6","5864d2df79ce642d00f0fed7","5864d2df79ce642d00f0fed8","5864d2df79ce642d00f0fed9","5864d2df79ce642d00f0feda","5864d2df79ce642d00f0fedb","5864d2df79ce642d00f0fedc","5864d2df79ce642d00f0fedd","5864d2df79ce642d00f0fede","598aa64f4b6e990019b7a2d2","599bc76bc03fa2000f83db2a","599bcc3c3c5bf7000f3434fc"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2"},"__v":6,"githubsync":"","project":"56439dfe9eebf70d00490d54","user":"55dd6b48a649eb170083b97a","parentDoc":null,"category":{"_id":"5864d2df79ce642d00f0fec9","project":"56439dfe9eebf70d00490d54","__v":0,"version":"5864d2df79ce642d00f0fec7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-01-19T00:09:16.715Z","from_sync":false,"order":1,"slug":"authentication","title":"Authentication"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-02-04T16:41:19.068Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"settings":"570423d459c5190e000ab6c0","examples":{"codes":[{"language":"json","code":"{\n    \"client_key\" : \"c2hlZWJhbkBnb29ydWxlYXJuaW5nLm9yZw==\", \n    \"client_id\" : \"ba956a97-ae15-11e5-a302-f8a963065976\", \n    \"grant_type\" : \"credential\"\n}","name":"Request Body"}]},"method":"post","results":{"codes":[{"code":"{\n\t\"user_id\": \"6c8f5634-8950-4e18-9e36-1e36fa848115\",\n\t\"app_id\": null,\n\t\"partner_id\": null,\n\t\"username\": \"01TestUser\",\n\t\"provided_at\": 1505208751474,\n\t\"email\": \"01test.gooru:::at:::gooru.org\",\n\t\"cdn_urls\": {\n\t\t\"user_cdn_url\": \"//usercdn.gooru.org/\",\n\t\t\"content_cdn_url\": \"//cdn.gooru.org/\"\n\t},\n\t\"tenant\": {\n\t\t\"tenant_id\": \"ba956a97-ae15-11e5-a302-f8a963065976\",\n\t\t\"tenant_root\": null\n\t},\n\t\"preference_settings\": {\n\t\t\"standard_preference\": {\n\t\t\t\"K12.SC\": \"CCSS\"\n\t\t}\n\t},\n\t\"access_token_validity\": 3600,\n\t\"access_token\": \"MjoxNTA1MjA4NzUxNDc1OjZjOGY1NjM0LTg5NTAtNGUxOC05ZTM2LTFlMzZmYTg0ODExNTo6YmE5NTZhOTctYWUxNS0xMWU1LWEzMDItZjhhOTYzMDY1OTc2\",\n\t\"first_name\": \"Gooru\",\n\t\"last_name\": \"TestUser\",\n\t\"user_category\": \"teacher\",\n\t\"thumbnail\": null\n}","name":"","status":200,"language":"json"}]},"auth":"required","params":[{"_id":"59b7a732944cbe0030844e22","ref":"","in":"header","required":true,"desc":"Base64 encoded username and password","default":"Basic MDF0ZXN0dXNlcjpnb29ydTEyMw==","type":"string","name":"Authorization"},{"_id":"59b7a732944cbe0030844e21","ref":"","in":"header","required":false,"desc":"Type of the content sent in request body","default":"application/json","type":"string","name":"Content-Type"}],"url":"/signin"},"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\nPay close attention to the resulting \"access token\" as it must be used in the header of all other requests in the future. However, on subsequent 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":"Sign in - User"}

postSign in - User

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

Definition

{{ api_url }}{{ page_api_url }}

Parameters

Headers

Authorization:
required
stringBasic MDF0ZXN0dXNlcjpnb29ydTEyMw==
Base64 encoded username and password
Content-Type:
stringapplication/json
Type of the content sent in request body

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/) Pay close attention to the resulting "access token" as it must be used in the header of all other requests in the future. However, on subsequent 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 }}