<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Icarus’ Wings - Medium]]></title>
        <description><![CDATA[IcarusWorks is a small software development studio based in Burlington, Vermont. We specialize in creating web and mobile applications using Ember.js, React, and Ruby on Rails. http://icarus.works/ - Medium]]></description>
        <link>https://medium.com/icarus-wings?source=rss----a885c6778ae7---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Icarus’ Wings - Medium</title>
            <link>https://medium.com/icarus-wings?source=rss----a885c6778ae7---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 20:36:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/icarus-wings" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Super Calendar]]></title>
            <link>https://medium.com/icarus-wings/a-super-calendar-8de3174fd447?source=rss----a885c6778ae7---4</link>
            <guid isPermaLink="false">https://medium.com/p/8de3174fd447</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jordan Morano]]></dc:creator>
            <pubDate>Thu, 02 Mar 2017 18:16:37 GMT</pubDate>
            <atom:updated>2017-03-01T19:55:35.388Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently, we finished work on a major feature upgrade for one of our clients, <a href="https://thefitbot.com/index.html">Fitbot</a>, a web application for professional personal trainers. We were tasked with making a custom calendar and workout editor that had a lot of crucial features:</p><ul><li>Inline editing and inserting</li><li>Drag and drop</li><li>Bulk editing and deleting</li><li>Popovers and modals</li></ul><p>While building out the calendar to meet the needs above, we quickly ran into the issue of performance. A trainer would use the calendar to update a specific client’s workouts, which could be a lot of workouts if they were a long-term client of the trainer. We also developed a nested tree of components that would handle all of the inline editing that the calendar required (and to make the feature worthy of the upgrade), but it was really painful if we had to re-render any of these component trees at all since each one had so many child components.</p><h3>Optimize request to the server</h3><h4>Scope request to the server to just workouts that we needed</h4><p>We recognized that the tool that we were building would be used heavily by the core users of the app platform. Therefore, we knew off the bat that we wanted to scope the requests to the server to just the data that the trainer would need. We handled this by requesting workouts for the previous, current, and next months. When a trainer would change months, we would fetch the workouts that were needed in order to always maintain the one-month buffer around the current month. We separated the request for the current month from the buffer months, allowing for the latter requests to not have any negative impact on the page load time.</p><h4>Cache workouts and track ones already requested</h4><p>We also added a simple caching system that would track the months for which workouts were requested and not make duplicative requests when shuffling between months. The calendar route’s model pointed to the cache, allowing it to immediately resolve if the cache already contained the required workout data.</p><p>We went with storing the fetching and caching logic on the parent model, the client, which also enabled us to easily test it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a926d9cd62f96fcac45afa7be6bb028/href">https://medium.com/media/5a926d9cd62f96fcac45afa7be6bb028/href</a></iframe><h3>Manually handling workouts on each day</h3><h4>Creating a workout distributor service</h4><p>The calendar had some robust requirements and to meet all of them, we used a nested component structure, e.g. workout-editor/workout-calendar and workout-editor/workout-form. One of the features was for a trainer to easily update the day for a single workout or a group of them. Updating the day of a workout impacted where the workout would appear on the calendar. Our initial fallback approach was to use computed properties and re-cache the day’s workouts when the due date changed on them. This had a huge cost with re-rendering, especially since we had such a complex tree of required components. Instead, we managed the collection of workouts on a day manually through a service that allowed us to scope the changes to only the days that were impacted vs globally clobbering and resetting all the day workouts.</p><p>The service was in charge of all rendering of workouts on the calendar from the initial load to bulk changes, shuffling around workout days. When the trainer would delete a group of workouts, we would have the service update and remove the workouts from each calendar day. It also handled more complex scenarios of inserting a group of workouts, starting on a single day and retaining the same spacing, e.g. Workout — Day 1 and Workout — Day 5 have a spacing of 4. We needed this in order to paste copied workouts or when dragging a group of workouts. Besides updating the day collections, the service also had to handle updating and persisting the information to the server, updating the workout due date and order (the position of the workout in the day).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a76117a31c5076dbb58c44dd154264c/href">https://medium.com/media/9a76117a31c5076dbb58c44dd154264c/href</a></iframe><h4>Multiple calendar types</h4><p>The above also had to be handled across not just one but two calendar types with subtle differences. A client calendar would have workouts with due dates, while a program calendar would have workouts just with positions and no due dates. The position or due date would help us determine the correct spread when applying bulk changes to the workouts, which is pretty straightforward on the surface. Rather than add complexity to the service, we offloaded some of it to a Day model with a subclass specifically tailored for a client calendar and another for a program calendar.</p><h3>All put together</h3><p>To recap, the calendar route’s model would grab the cache data and make a server request if required. The service then would grab a copied reference to that model collection and take over managing where the data would appear on the calendar. Each calendar day was a model with logic that would help the service distribute or redistribute the workouts when called upon to do so. The Day model’s logic was especially useful when we needed to extend it with adding the ability to copy workouts across calendar types while maintaining the proper spacing.</p><p>In the end, managing the collections manually was riskier but provided a huge win with page rendering and making the entire experience of moving a group of workouts feel fast and fluid. Also, having all of the important logic in the service and model made it really easy to test. We were able to build a robust calendar that meets all of the many needs of its users.</p><h3>Acknowledgements and appreciations</h3><p>A big thank you to <a href="https://thefitbot.com/index.html">Fitbot</a> for giving us the opportunity to spearhead development on this calendar feature. We hope that its core users enjoy the new interface and appreciate the efforts we made in order to boost their productivity.</p><p>The ‘we’ referred to several times in this post is me, <a href="https://github.com/jordpo">Jordan</a>, and my business partner, <a href="https://github.com/patrickberkeley">Patrick Berkeley</a>, at our Ember + Rails/Elixir consultancy, <a href="http://icarus.works/">IcarusWorks</a>. As we indicated on our website, we love solving interesting problems with the latest web technology tools. We’re a scrappy and small team that can do all of the above — software strategy, architecture and development. We love hearing about new problems and/or products and seeing if we can work together. Please feel free to reach out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8de3174fd447" width="1" height="1" alt=""><hr><p><a href="https://medium.com/icarus-wings/a-super-calendar-8de3174fd447">A Super Calendar</a> was originally published in <a href="https://medium.com/icarus-wings">Icarus’ Wings</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploy an Ember.js app to Google Cloud]]></title>
            <link>https://medium.com/icarus-wings/deploy-an-ember-js-app-to-google-cloud-18f2d68c6a4e?source=rss----a885c6778ae7---4</link>
            <guid isPermaLink="false">https://medium.com/p/18f2d68c6a4e</guid>
            <category><![CDATA[google-cloud-storage]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Patrick Berkeley]]></dc:creator>
            <pubDate>Wed, 21 Sep 2016 13:45:21 GMT</pubDate>
            <atom:updated>2017-04-04T13:16:12.459Z</atom:updated>
            <content:encoded><![CDATA[<p>We typically deploy our Ember.js applications to Heroku. Having a Heroku instance to serve the few static files that make up an Ember application is overkill, but Heroku’s CLI and UI make it so easy to deploy and maintain we have hard time turning away from it.</p><p>A recent client had the requirement the Ember application hit the API from a static IP address. We initially looked into sticking with Heroku and one of the add-ons that provides a static IP address for an instance, but that approach got messy quickly. We looked at a few other options and settled on creating a Google Cloud (GC) Storage bucket and mounting that from a GC Compute instance with a dedicated IP address. This article details how to get that set up.</p><h3>In your Ember app</h3><p>We’ll be using <a href="http://ember-cli-deploy.com/">ember-cli-deploy</a> for deployment to GC. Install the necessary add-ons:</p><pre>ember install ember-cli-deploy ember-cli-deploy-build ember-cli-deploy-display-revisions ember-cli-deploy-gcloud-storage ember-cli-deploy-gcs-index ember-cli-deploy-revision-data</pre><p>Set your config/deploy.js to the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1900050ccae7dfe21d276bf8abe405fc/href">https://medium.com/media/1900050ccae7dfe21d276bf8abe405fc/href</a></iframe><p>Don’t forget to set the projectId and bucket variables to your own.</p><h3>On Google Cloud</h3><p>Sign in to <a href="https://cloud.google.com/">Google Cloud</a>.</p><h4>Set up a Compute Engine instance</h4><p>All you need to do here is <a href="https://cloud.google.com/compute/docs/instances/create-start-instance">create a Compute Engine instance</a>. I’d stick with the default Debian instance and the smallest instance size available.</p><h4>Create a bucket</h4><p>Follow <a href="https://cloud.google.com/storage/docs/cloud-console#_creatingbuckets">Google’s guide on creating a bucket</a>.</p><p>Make the bucket and its object readable to the public by <a href="https://cloud.google.com/storage/docs/cloud-console#_bucketpermission">setting permissions on both the bucket and its objects</a>. Add a permission with Entity: User, Name: allUsers, Access: Reader.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*fQmcF-obEVD1h-2GMY80Eg.png" /></figure><h4>Setup a deploy user</h4><p>In order for the ember deploy add-ons to have permission to deploy to your Google Cloud Storage bucket, you’ll need to create a special type of account on Google Cloud called a Service Account.</p><p>Navigate to IAM &amp; Admin &gt; Service Accounts in the GC console. <a href="https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#createanewserviceaccount">Create a service account</a> and save the credentials to /config/gcs-service-account-creds.json in your Ember application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*icDasOWh2hM37RBFz33H3Q.png" /></figure><h4>Set a static ip on the instance</h4><p><a href="https://cloud.google.com/compute/docs/configure-instance-ip-addresses#reserve_new_static">Reserve a static IP address</a> and assign it to your Compute Engine instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E07AqwxWKxH32f-paie40Q.png" /></figure><h4>Connect the instance to the bucket</h4><p>Follow Google’s great article on <a href="https://cloud.google.com/compute/docs/disks/gcs-buckets#mount_bucket">how to mount a bucket as a file system from an instance</a>. This includes setting up Cloud Storage FUSE. <a href="https://github.com/GoogleCloudPlatform/gcsfuse/blob/master/docs/installing.md#ubuntu-and-debian-latest-releases">The instructions for installing GCS Fuse</a> work correctly with the small modification of needing to allow all users to access the mounted bucket. This allows your web server (see NGINX below) to access the files in the bucket.</p><p>Before you mount the bucket with GCS Fuse, uncomment user_allow_other in /etc/fuse.conf on your instance.</p><pre>sudo vim /etc/fuse.conf</pre><p>Then mount with the allow_other option.</p><pre>gcsfuse -o allow_other [BUCKET_NAME] /mnt/gcs-bucket</pre><h4>Set up NGINX</h4><p>Install NGINX on the instance in order to serve the index file and assets for your Ember app:</p><pre>sudo apt-get install nginx</pre><p>Create directories for the NGINX logs:</p><pre>sudo mkdir /logs<br>sudo mkdir /logs/nginx</pre><p>Set up your NGINX config to proxy request from your Ember app to api/ endpoints to your API’s IP address or URL.</p><pre>sudo vim etc/nginx/nginx.conf</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/106bddda4ccca71913a650c3a8e337a1/href">https://medium.com/media/106bddda4ccca71913a650c3a8e337a1/href</a></iframe><p>Don’t forget to set the proxy_pass value in the config to your API’s IP or URL.</p><p>Now you should be able to run the normal ember deploy commands e.g., ember deploy production --activate=true. If all goes well, you’ll be able to:</p><ol><li>See the index and assets for your Ember app appear in your GCS bucket</li><li>Visit the static IP you assigned to your instance and see the Ember app load.</li></ol><p>That’s it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*YcLpE2K7czuUHhcACwMeYg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18f2d68c6a4e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/icarus-wings/deploy-an-ember-js-app-to-google-cloud-18f2d68c6a4e">Deploy an Ember.js app to Google Cloud</a> was originally published in <a href="https://medium.com/icarus-wings">Icarus’ Wings</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What to look for in a Pull Request review]]></title>
            <link>https://medium.com/icarus-wings/what-to-look-for-in-a-pull-request-review-bf9b196bd4f6?source=rss----a885c6778ae7---4</link>
            <guid isPermaLink="false">https://medium.com/p/bf9b196bd4f6</guid>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Patrick Berkeley]]></dc:creator>
            <pubDate>Thu, 17 Mar 2016 14:16:11 GMT</pubDate>
            <atom:updated>2016-03-17T14:16:00.586Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Preface</strong></h4><p>We are currently integrating several development teams from around the world for our current client; one from the Ukraine and another from Columbia. Overall the process has been smooth, but there have been a rough spots. Most of these rough spots have pointed to processes that we — IcarusWorks — have not defined and documented clearly. Much of the knowledge from which we base our work is transferred in-person across the desk, and working with teams around the world has quickly pointed out these holes in our processes.</p><h4><strong>On Pull Requests</strong></h4><p>One of the processes that has lacked definition, and the focus of this post, is the process for both giving and receiving reviews on <a href="https://help.github.com/articles/using-pull-requests/">GitHub Pull Requests</a>. I’ll be focusing specifically on the thinking that goes into a Pull Request (PR) review, and likewise what I hope reviewers of my code are going through when they review my code.</p><h4><strong>Questions to ask in a Pull Request review</strong></h4><p>Here are the questions I look to give or get in a code review. There are probably more good questions, but these are the ones I find most important. These questions might also help determine whom the reviewer(s) should be for each PR:</p><ul><li>Does it solve the problem as defined in the ticket?</li><li>Does it fit into the overall application architecture?</li><li>Is it well architected as a whole?</li><li>Does it follow best practices?</li><li>Is the syntax correct?</li><li>Does it improve or less the maintainability of the code base?</li><li>Is it inline with — or does it enhance — the branding and styles?</li></ul><p>Often when I’m reviewing I usually need to read the code a few times to hold each question at the fore of my mind while I’m reading.</p><h4><strong>Reviewer traits</strong></h4><p>Another factor to take into account when giving or receiving a review is if — and how well — the reviewer is qualified for the review. For our current client, we’re using <a href="http://emberjs.com/">Ember.JS</a> for the UI and <a href="http://rubyonrails.org/">Ruby on Rails</a> for the API. Some traits we look for in reviewers that make them well suited for a review:</p><p><strong>Both UI &amp; API</strong></p><ul><li>Have knowledge of — and an eye for — security and vulnerabilities</li><li>Understand the overall goals of the business</li><li>Familiarity with code styles defined for the project</li></ul><p><strong>API</strong></p><ul><li>Understand the server architecture</li><li>Solid Ruby knowledge</li></ul><p><strong>UI</strong></p><ul><li>Ability to put on the end-user-hat when reviewing code and imagine what the processes the new code introduces will feel like. In short: empathize.</li><li>Have an eye for design</li><li>Understand the brand</li><li>Knowledge of BEM and how to write CSS in a maintainable way for a large application</li><li>Solid Ember.JS knowledge</li><li>Understand UI app architecture. This ties into ember knowledge with add-ons.</li></ul><h4>Closing</h4><p>The questions I’ve laid out above are straightforward, but if they’re each taken into account when giving a review, the review will be solid.</p><p>In case you’re curious, we have more articles and info on software development, who we are at <a href="http://icarus.works/">IcarusWorks</a>, and life on our <a href="https://medium.com/icarus-wings">publication page</a> and <a href="http://icarus.works/">website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf9b196bd4f6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/icarus-wings/what-to-look-for-in-a-pull-request-review-bf9b196bd4f6">What to look for in a Pull Request review</a> was originally published in <a href="https://medium.com/icarus-wings">Icarus’ Wings</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ember.js with Single Sign On]]></title>
            <link>https://medium.com/icarus-wings/ember-js-with-single-sign-on-3e86dca44d55?source=rss----a885c6778ae7---4</link>
            <guid isPermaLink="false">https://medium.com/p/3e86dca44d55</guid>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[ember]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Jordan Morano]]></dc:creator>
            <pubDate>Fri, 04 Mar 2016 00:17:25 GMT</pubDate>
            <atom:updated>2016-03-04T00:28:04.933Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A SSO solution using Ember and Ember SimpleAuth with cookie based storage.</em></p><p>Recently for a client, we found ourselves in the position where we needed to address the need for the user and a single client-side session across more than 1 domain. These domains all had the same parent (luckily) and would each host a separate Ember.js application. So we needed a single sign on solution that satisfied the needs of an Ember ecosystem.</p><p>We’ve been using an addon called <a href="https://github.com/simplabs/ember-simple-auth">Ember Simple Auth</a> made by the team at Simple Labs for all of our Ember projects. Therefore, it made sense to find a solution that would also make use of the same addon. It’s a really great library with built-in authorizers and authenticators that along with its session service, easily meets all of our session management needs on the client-side.</p><p>In the past, we would use the oAuth2 authenticator and authorizer, along with the default LocalStorageStore for managing the access token. For a single sign on path, the local storage wasn’t going to cut it, since the applications were hosted on different domains. The CookieStore, though, was exactly what we wanted, since you can easily set a cookie on a parent domain that is then accessible on all of its subdomains. And what sealed the deal for us, was Simple Auth’s API extracting out all of the cookie management for us.</p><p>After we settled on how we were going to store the access token and configured the cookie domain, all that remained to do was to configure the authenticator(s), set the application authorizer, and wrap the session service in our own custom service.</p><p><strong>Why use a custom service wrapper instead of Ember Simple Auth’s session service directly?</strong></p><p>Good question! There is usually more to a client-side session that you want to manage than just authenticating and de-authenticating. We found that we generally need easy access to the user account that is currently signed in throughout various parts of our application. There is also Ember Store cleanup that is good practice to have when a user signs out. All of this promotes the case for our own custom session. With Ember Simple Auth 1.0, extending its Session object directly was deprecated in favor of using Ember’s dependency injection API for services, which is really great and easy to use.</p><p>If you ever find yourself in a similar situation where you need a single sign on solution for multiple subdomains using Ember.js, I can’t recommend enough using Ember Simple Auth and a cookie-based store for the access token. I’m also sharing a gist below with all of the application code you should need to get a cookie-based authentication going on your own app platform.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce071f661e78a6c6388b3c0fa5c4cd42/href">https://medium.com/media/ce071f661e78a6c6388b3c0fa5c4cd42/href</a></iframe><p>Thanks for reading! In case you are curious, we have more articles and info on software development, who we are at IcarusWorks, and life on our <a href="https://medium.com/icarus-wings">publication page</a> and <a href="http://icarus.works/">website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e86dca44d55" width="1" height="1" alt=""><hr><p><a href="https://medium.com/icarus-wings/ember-js-with-single-sign-on-3e86dca44d55">Ember.js with Single Sign On</a> was originally published in <a href="https://medium.com/icarus-wings">Icarus’ Wings</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Social Sign In + Ember]]></title>
            <link>https://medium.com/icarus-wings/social-sign-in-ember-d902f563bba?source=rss----a885c6778ae7---4</link>
            <guid isPermaLink="false">https://medium.com/p/d902f563bba</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[ember]]></category>
            <dc:creator><![CDATA[Jordan Morano]]></dc:creator>
            <pubDate>Fri, 04 Mar 2016 00:17:01 GMT</pubDate>
            <atom:updated>2016-03-04T00:16:49.300Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Goal</h3><p>Social sign-in appears to be a simple feature on the outside that is quite complex once you dive below the surface. I knew going into it that it was an ambitious goal to achieve three social sign-ins on an Ember app.</p><p>Let’s get to it then- in the most simple and concise way possible. This assumes that you use Ember Simple Auth to handle the client-side authentication, Ember CLI as the app framework, and authorization headers with tokens to manage the session and send requests to the server.</p><p>The goal is to introduce an additional sign up flow other than password grant that looks something like this:</p><ol><li>User authenticates using a third party provider, like Facebook.</li><li>We take that authorization code and send it to our rails server.</li><li>We get the access token and user info from the provider’s api.</li><li>We compare that user info with our user table and match that user to either a pre-existing user via email or create a new one.</li><li>We save the identity linking all of this information (provider, UID, access token, and user).</li><li>Finally, we create and send back our own application’s OAuth token to authenticate the user’s session.</li></ol><h3>Client-side authentication with a provider</h3><p>The first stop is to familiarize ourselves with the Torii plugin and install it on our app. This handles all of the heavy-lifting that authorizes the user with the provider.</p><p>We want to add the configuration settings to our environment.js file for all of the providers with which we want to authenticate. It will look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d7351b7ac7749a74b9ae0b387516ad51/href">https://medium.com/media/d7351b7ac7749a74b9ae0b387516ad51/href</a></iframe><h4>Build a Torii Provider</h4><p>The next step is to build our provider. If you aren’t already familiar, I would encourage you to take a look at Torii’s readme for an in-depth explanation. For the providers that use OAuth2, like Facebook and Google+, Torii comes with provider definitions that connect and authenticate with the third party.</p><p>Since we want to authenticate the user in our application after getting the third party authorization, this out-of-the-box functionality isn’t yet complete. To complete this we extend the default open method through a creative use of this._super():</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbe522215d320b47ec53dd0cf1da0475/href">https://medium.com/media/dbe522215d320b47ec53dd0cf1da0475/href</a></iframe><p>It is important to note that at this point we only get the authorization code back from the provider. We make a POST request to our server to fetch the access token and user information.</p><p>We then want to include this logic in our provider definition. Torii looks for its providers to be defined in the app/torii-providers directory. By using the same provider name, like facebook-oauth2, we can reopen, access and override the built-in providers. This replaces Torii’s facebook-oauth2 with our own facebook-oauth2 and custom open functionality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aedbf8b4ea420a097dbc3a2c74917512/href">https://medium.com/media/aedbf8b4ea420a097dbc3a2c74917512/href</a></iframe><h4>Build a Custom Authenticator</h4><p>Now we want to define our own custom authenticator. We can do this in the app/authenticators folder or wherever (location doesn’t matter since we will import it explicitly later).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94d66a3fd06a4ca30f936b26aed111bb/href">https://medium.com/media/94d66a3fd06a4ca30f936b26aed111bb/href</a></iframe><p>Since we are using OAuth2 for our normal password sign-in flow, it is important to extend our authenticator from OAuth2.</p><p>We register it on the container and make sure that its torii property is defined; this lets us use the torii functionality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8546ee3e8bfce344370d6a78b8e8b472/href">https://medium.com/media/8546ee3e8bfce344370d6a78b8e8b472/href</a></iframe><h4>Use the Custom Authenticator</h4><p>Registering the authenticator on the app’s container, allows us to simply use it when we want to:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3d94df2365612940b80c9930892bd961/href">https://medium.com/media/3d94df2365612940b80c9930892bd961/href</a></iframe><p>Here we have an action that can get mixed into our sign-in and sign-up controllers, called with the provider name passed in as an argument. This allows us to handle multiple provider sign-in buttons on the same page.</p><p>That’s it from the client-side! With the above code, we’ve accomplished fetching the authorization code from Facebook and passing it back to our rails server. Now we need to verify that code and return back an access token for our application if successful.</p><h3>Rails-side verification and access token</h3><p>We’ve now sent a POST request to our server with these three params: authorization_code, provider, and grant_type.</p><h4>Create a Custom Endpoint</h4><p>We send this information to an action on the OAuth controller.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a032138409938e4126ef473e293a41f2/href">https://medium.com/media/a032138409938e4126ef473e293a41f2/href</a></iframe><p>Here we pass our provider and code params to a class method on an Identity model. We then persist that information and upon success we create a new OAuth token and render it back to the UI.</p><p>The Identity model and table stores the provider information (access token, user id, provider name), as well as the user association. The key purpose of this model is to take the authorization code and provider and locate or create a new identity for the user. Let’s take a closer look.</p><h4>Identity Model</h4><p>This model is the link between our application and the provider for a user. With an authorization code and provider, it should be able to check that the code is correct and sync up the user. We use a single class method to handle this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40161b6e279167a578794bc3902e23c3/href">https://medium.com/media/40161b6e279167a578794bc3902e23c3/href</a></iframe><p>Looking at this closer, we use a PORO (Plain Old Ruby Object) service, RequestToken, to handle the API requests to the provider. RequestToken.request returns an instantiated object that contains user_data and the access_token. We use the user id from the provider (the UID) to initialize or find an identity model.</p><p>If we add email, first name and last name as attr_accessors on the Identity model, we can find or create the user association in a callback- I found this useful and self-contained.</p><p>So what is going on in the RequestToken service? Let’s take a look.</p><h4>RequestToken — where provider api logic lives</h4><p>It is here that that we handle all of the API calls to the provider. We can store the api urls in a hash constant and dynamically reference the correct one based on the provider.</p><p>There are two API calls that we make: one to fetch the access token and another for the user information. We write two separate methods for this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e4894ca2a3cda821743eae5193f61021/href">https://medium.com/media/e4894ca2a3cda821743eae5193f61021/href</a></iframe><p>We use HTTParty to handle the requests. It’s nice that the OAuth2 specs make the requests conventional across different providers. The above works for Facebook, Google+, and LinkedIn.</p><p>We need to also make sure to define methods to point to the correct api key and api secret, based on the provider.</p><h3>Wrap up</h3><p>That’s pretty much it! Hope you enjoyed the ride. I was able to add social sign in for LinkedIn, Facebook, and Google+ using the above approach. I plan to go over Twitter authentication in a separate post, which uses slightly different logic and OAuth1.</p><p>Thanks for reading! In case you are curious, we have more articles and info on software development, who we are at IcarusWorks, and life on our <a href="https://medium.com/icarus-wings">publication page</a> and <a href="http://icarus.works/">website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d902f563bba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/icarus-wings/social-sign-in-ember-d902f563bba">Social Sign In + Ember</a> was originally published in <a href="https://medium.com/icarus-wings">Icarus’ Wings</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IcarusWorks: Why, what, who, how]]></title>
            <link>https://medium.com/icarus-wings/icarusworks-why-what-who-how-6b159fa0b117?source=rss----a885c6778ae7---4</link>
            <guid isPermaLink="false">https://medium.com/p/6b159fa0b117</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Jordan Morano]]></dc:creator>
            <pubDate>Wed, 10 Feb 2016 23:22:49 GMT</pubDate>
            <atom:updated>2016-02-10T23:28:36.419Z</atom:updated>
            <content:encoded><![CDATA[<p><em>We wanted to start this publication with the inaugural, self-reflecting post. Arguably the most important time for this kind of reflection is when you are first getting started…</em></p><h3>Why</h3><p>Our goal is to build software that has a <em>tangible, positive impact</em> starting with local and moving outwards. We seek to help other beings in a real way, in both direct positive interactions and indirect improvements in experiences through software.</p><h3>What</h3><p>Our primary motivation is to transform systems to make the exchange of information accessible and easy to understand. These systems can range from existing software applications to new platforms that are currently unsupported by software. We are committed to overcoming challenges as they arise.</p><p>Our principles as creators:</p><ul><li>create quality interactions and meaningful relationships</li><li>build applications with a verified positive impact for the end user</li><li>deliver readable and maintainable code</li><li>remain unattached and open to new technologies and ideas</li></ul><h3>Who</h3><p>We are different than other software agencies. We are <strong>lean</strong> and <strong>focused. </strong>We are <strong>thoughtful</strong> in what, why, and how we do what we do. We have <strong>balanced </strong>skills and competencies: detail-oriented design vs functionality, refined and polished end experiences vs fast iterations and development efficiency. We <strong>care</strong> about the people with whom we interact, and we are personally invested in each product that we build.</p><h3>How</h3><p>We bring high level thinking and understanding to software creation. We are the technology bridge from concept to viable product, respecting budget and scope constraints. We choose technologies that deliver fluid and engaging user experiences. We use the best tools for the job, and hold no ideological bias. That said, we are experts in <a href="http://emberjs.com/">Ember.js</a> for web browsers, <a href="https://facebook.github.io/react-native/">React Native</a> for mobile applications, and <a href="http://rubyonrails.org/">Ruby on Rails</a> for APIs.</p><p>We build software for web and mobile platforms. We bring software from concept to end users. Our practices push boundaries further and deliver high quality code and reduce technical debt. We value open source and make contributions to the community. We’re dedicated to improving and growing through constant iteration and refinement.</p><p><em>We are…</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xtRoVfP8lZl0VZ90IxDVfg.jpeg" /><figcaption>Our logo</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b159fa0b117" width="1" height="1" alt=""><hr><p><a href="https://medium.com/icarus-wings/icarusworks-why-what-who-how-6b159fa0b117">IcarusWorks: Why, what, who, how</a> was originally published in <a href="https://medium.com/icarus-wings">Icarus’ Wings</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>