{"_id":"55a4f5bb02b09d1900d00aac","project":"55a47338e75ca60d00a3932f","user":"55a4f13d02b09d1900d00a9f","__v":5,"category":{"_id":"55a4fb7e1a5f991700a940f0","pages":["55a4fbe51a5f991700a940f4"],"project":"55a47338e75ca60d00a3932f","__v":1,"version":"55a47338e75ca60d00a39332","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-14T12:07:26.177Z","from_sync":false,"order":0,"slug":"getting-started","title":"Getting Started"},"version":{"_id":"55a47338e75ca60d00a39332","project":"55a47338e75ca60d00a3932f","__v":8,"createdAt":"2015-07-14T02:26:00.724Z","releaseDate":"2015-07-14T02:26:00.724Z","categories":["55a47339e75ca60d00a39333","55a4fb7e1a5f991700a940f0","55a6702b80c8a30d00b32684","55a6703b80c8a30d00b32685","55a6ea5516d20b1900ed8f53","55b23ad2329f363900fbc92f","55b23b0a329f363900fbc932","55b2426a0e11590d008f7950"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-14T11:42:51.703Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":2,"body":"Step 1: Register your app\n---\nTo start things off, the rain gods need to know about your application. This can be done by visiting `make.lono.io`, and clicking Login in the upper right. Login with your Lono account, and click the dev settings button in the navbar.\n\n![Dev Portal](http://make.lono.io/docs/devportal.png)\n\nClick `Add a new Application`, and fill out the required fields. Enter the approximate amount of users that you expect to use the application (If you are thinking of selecting `Just Me` then take a look at creating a [single user application](doc:getting-started)). Note that the callback URL cannot be changed, and without this users won't be able to authorize and use the app.\n![Add a new application](http://make.lono.io/docs/newapp.png)\n\nAfter clicking `Create my app, mon!`, Lono knows about your application!\n\nStep 2: Record your keys and make a request\n---\nMake sure to keep track of your `Client Id` and `Client Secret` - you'll need these later! Next, click `Test OAuth Request` - this will prompt you for authorization for your third party application to be given write access to your Lono. If you are thinking of deploying your app publicly, then this is the place you'll want to send new users. After allowing the request, you will be redirected. Here's a quick map of the structure, so you can craft a valid request:\n```\n/dialog/authorize\n?response_type=code\n&client_id=[Client ID of Application]\n&redirect_uri=[Where to Redirect on a successful query]\n&scope=[Permissions, comma seperated. [more about this here](request-permissions)]\n```\n\n\nStep 3: Find your keys!\n---\nOnce a user has authorized, listen on that callback URL: a request will come containing the authorization code in the body. That request will contain:\n```\ncode: [auth token]\n```\nIt will be a `GET` request to the specified callback url.\n\nStep 4: Get your session token\n---\nRun the command below, replacing values where specified.\n\n```bash\ncurl -X POST -H \"Content-Type: application/json\" -d '\n{\n  \"grant_type\": \"authorization_code\",\n  \"client_id\": \"[CLIENT ID HERE]\",\n  \"client_secret\": \"[CLIENT SECRET HERE]\",\n  \"code\": \"[ACCESS TOKEN HERE]\"\n}' http://make.lono.io/oauth/token\n```\nThis query returns, if formatted correctly:\n\n```json\n{\n  \"access_token\": \"[ACCESS TOKEN]\",\n  \"token_type\": \"bearer\"\n}\n```\n\nStep 5: Do some stuff!\n---\nNow, with an access token, you can command the rain gods! Take a look to the right for all the API calls you can make!","excerpt":"","slug":"getting-started-production","type":"basic","title":"Getting Started with Lono: Production Application"}

Getting Started with Lono: Production Application


Step 1: Register your app --- To start things off, the rain gods need to know about your application. This can be done by visiting `make.lono.io`, and clicking Login in the upper right. Login with your Lono account, and click the dev settings button in the navbar. ![Dev Portal](http://make.lono.io/docs/devportal.png) Click `Add a new Application`, and fill out the required fields. Enter the approximate amount of users that you expect to use the application (If you are thinking of selecting `Just Me` then take a look at creating a [single user application](doc:getting-started)). Note that the callback URL cannot be changed, and without this users won't be able to authorize and use the app. ![Add a new application](http://make.lono.io/docs/newapp.png) After clicking `Create my app, mon!`, Lono knows about your application! Step 2: Record your keys and make a request --- Make sure to keep track of your `Client Id` and `Client Secret` - you'll need these later! Next, click `Test OAuth Request` - this will prompt you for authorization for your third party application to be given write access to your Lono. If you are thinking of deploying your app publicly, then this is the place you'll want to send new users. After allowing the request, you will be redirected. Here's a quick map of the structure, so you can craft a valid request: ``` /dialog/authorize ?response_type=code &client_id=[Client ID of Application] &redirect_uri=[Where to Redirect on a successful query] &scope=[Permissions, comma seperated. [more about this here](request-permissions)] ``` Step 3: Find your keys! --- Once a user has authorized, listen on that callback URL: a request will come containing the authorization code in the body. That request will contain: ``` code: [auth token] ``` It will be a `GET` request to the specified callback url. Step 4: Get your session token --- Run the command below, replacing values where specified. ```bash curl -X POST -H "Content-Type: application/json" -d ' { "grant_type": "authorization_code", "client_id": "[CLIENT ID HERE]", "client_secret": "[CLIENT SECRET HERE]", "code": "[ACCESS TOKEN HERE]" }' http://make.lono.io/oauth/token ``` This query returns, if formatted correctly: ```json { "access_token": "[ACCESS TOKEN]", "token_type": "bearer" } ``` Step 5: Do some stuff! --- Now, with an access token, you can command the rain gods! Take a look to the right for all the API calls you can make!