<?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[dev &lt;tech&gt; tips &amp; tricks - Medium]]></title>
        <description><![CDATA[my personal tips and tricks in creating, building, developing solutions in the technology space. - Medium]]></description>
        <link>https://medium.com/devtechtipstricks?source=rss----6c80a8cb2e89---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>dev &amp;lt;tech&amp;gt; tips &amp;amp; tricks - Medium</title>
            <link>https://medium.com/devtechtipstricks?source=rss----6c80a8cb2e89---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 08:35:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/devtechtipstricks" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Build a simple Rails API server + Auth0 JWT authentication + React from scratch in 30 minutes (or…]]></title>
            <link>https://medium.com/devtechtipstricks/build-a-simple-rails-api-server-auth0-jwt-authentication-react-from-scratch-in-30-minutes-or-257cbb2a939a?source=rss----6c80a8cb2e89---4</link>
            <guid isPermaLink="false">https://medium.com/p/257cbb2a939a</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ian Khor]]></dc:creator>
            <pubDate>Wed, 22 Mar 2017 02:50:33 GMT</pubDate>
            <atom:updated>2017-03-23T00:26:58.754Z</atom:updated>
            <content:encoded><![CDATA[<h3>Build a simple Rails API server + Auth0 JWT authentication + React from scratch in 30 minutes (or less)</h3><p><strong>TL;DR </strong>In a nutshell the following gif (it might take a minute to load) shows what this article is all about:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*QDNFxd1xpqQ7K_9CdrwYdA.gif" /><figcaption>React + Auth0 + Rails API demo</figcaption></figure><blockquote>Demo app is located at <a href="http://react-auth0-api.herokuapp.com/"><strong>http://react-auth0-api.herokuapp.com/</strong></a></blockquote><blockquote><strong>Note : If you access the site for the first time, it might take about 30 seconds to ping the API server as heroku needs to start up the app.</strong></blockquote><blockquote>Github-Rails API server : <a href="https://github.com/iankhor/ror-auth0-api">https://github.com/iankhor/ror-auth0-api</a></blockquote><blockquote>Github-React Front-end : <a href="https://github.com/iankhor/react-auth0-api">https://github.com/iankhor/react-auth0-api</a></blockquote><blockquote>A mate of mine, <a href="https://medium.com/u/a9cecb736aae">Jason H</a> — a great coder himself, got me thinking about authenticated API calls from a browser. So I thought to give it a crack myself !</blockquote><h4>Purpose</h4><p>The intention of this guide is for newcomers or startups who wants to quickly bring up a platform to get users. It does not follow any general best practices but serves as a guide to get an API server with a front-end up and running up quickly. This article is not the only way to do things but one of the ways to get some traction on your current project. If you run into any issues, I’d be happy to assist but Google is always your best companion</p><h4>Disclaimer</h4><p>If you are reading this 1 or 2 years from the time of this article was published, it is highly likely that the following steps could be outdated. I will try to update it as often as I could so tread with caution !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*faxdJwOIDSd-PKAkuE0ZjQ.jpeg" /></figure><h3>The Very Simple Plan</h3><p>We will start with a Rails API using <a href="https://auth0.com/">Auth0</a> and Postman to send GET &amp; POST requests to fetch authenticated data.</p><p><a href="https://auth0.com/">Auth0</a> handles the sign in/up process. It authenticates a user and supplies a <a href="https://jwt.io/"><strong>JSON Web Token (JWT)</strong></a><strong> </strong>that is will be sent in the header of a request to the API server.</p><p>The following simplified diagram below illustrates on a high level how the Rails API server will function initially without a front-end.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*rA77tUERswng4la1SbzO4w.png" /><figcaption><strong>Green</strong> — START of process. <strong>Red</strong> — end of process.</figcaption></figure><p>We will enhance the plan above by using a front-end framework. In this article we will be using <a href="https://facebook.github.io/react/">React</a>, however you can use any other framework to perform a similar logic.</p><p>The Rails API server is able to standalone without any dependancies on what front-end framework is being used.</p><h3>The Next Simple Plan</h3><p>Once we are confident that the Rails API server is functioning, we will use a front-end framework to perform the functionality of Postman as illustrated in a simplified diagram below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*yQUyz9JpVau8JMEnHzcJXw.png" /><figcaption><strong>Green</strong> — START of process. <strong>Red</strong> — end of process.</figcaption></figure><p>So lets begin !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*13fHsVu1qF6OhwTq2rggKQ.jpeg" /></figure><h3>BACK END — Rails API Server</h3><h4>Prerequisites, tools and items needed</h4><ol><li>Rails 5.0.0</li><li>Ruby 2.3.1</li><li><a href="https://auth0.com/">Auth0</a> client ID</li><li><a href="https://auth0.com/">Auth0</a> client secret</li><li><a href="https://auth0.com/">Auth0</a> domain ID</li><li>Auth0 dummy username and password (set one up after you have signed up with <a href="https://auth0.com/">Auth0</a>, this article assumes you have one set up with the username admin@admin.com and password admin)</li><li>Ruby gem rack-cors</li><li>Ruby gem bcrypt 3.1.11</li><li><a href="https://github.com/nsarno/knock">Ruby gem </a><a href="https://github.com/nsarno/knock">knock</a> 2.1.1(to handle jwt from <a href="https://auth0.com/">Auth0</a>)</li><li><a href="https://github.com/rails-api/active_model_serializers">Ruby gem </a><a href="https://github.com/rails-api/active_model_serializers">active_model_serializer</a> v.0.10.5</li><li><a href="https://github.com/bkeepers/dotenv">Ruby gem </a><a href="https://github.com/bkeepers/dotenv">dotenv-rails</a> v2.2.0 (for development only)</li><li><a href="https://github.com/stympy/faker">Ruby gem </a><a href="https://github.com/stympy/faker">faker</a> v1.7.3 (optional and used to generate fake data)</li><li>Ruby gem pg v0.20.0 (for postgres database)</li><li><a href="https://github.com/cyu/rack-cors">Ruby gem </a><a href="https://github.com/cyu/rack-cors">rack-cors</a> v0.4.1 (to handle cross-origin requests)</li><li><a href="https://www.getpostman.com/">Postman</a> (optional and used to test APIs)</li><li><a href="https://postgresapp.com/">Postgresapp</a> database server (this will serve as our local database server)</li><li>Rails API server will run on localhost:3000</li></ol><h4>Steps</h4><p>The following steps assumes you have Ruby, Rails, Postgresapp, Postman installed in your system. Make sure you have signed up for a <a href="https://auth0.com/">Auth0</a> account and have a client ID, domain and client secret. If you are still unsure what they are, read the <strong>Auth0 setup </strong>section of my other article <a href="https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-1-of-3-setup-18fa929e2cd7#.2s1tpwd3x">here</a> to get a feel how <a href="https://auth0.com/">Auth0</a> works.</p><ol><li>Create a Rails API app, run rails new ror-auth0-api --api --database=postgresql on your terminal</li><li>Create an environment variables file called .env in the root level of your app and add the following information from <a href="https://auth0.com/">Auth0</a></li></ol><pre>AUTH0_CLIENT_ID={CLIENT_ID}<br>AUTH0_DOMAIN={DOMAIN}<br>AUTH0_CLIENT_SECRET={CLIENT_SECRET}</pre><p>3. We need to tell rails to use the <a href="https://auth0.com/">Auth0</a> credentials. Update the secrets.yml file in config folder to look like below:</p><pre>development:<br>  secret_key_base: ...YOUR KEY GENERATED BY RAILS...<br>  auth0_client_id: &lt;%= ENV[&quot;AUTH0_CLIENT_ID&quot;] %&gt;<br>  auth0_client_secret: &lt;%= ENV[&quot;AUTH0_CLIENT_SECRET&quot;] %&gt;</pre><pre>test:<br>  secret_key_base: ...YOUR KEY GENERATED BY RAILS...<br>  auth0_client_id: &lt;%= ENV[&quot;AUTH0_CLIENT_ID&quot;] %&gt;<br>  auth0_client_secret: &lt;%= ENV[&quot;AUTH0_CLIENT_SECRET&quot;] %&gt;</pre><pre># Do not keep production secrets in the repository,<br># instead read values from the environment.<br>production:<br>  secret_key_base: &lt;%= ENV[&quot;SECRET_KEY_BASE&quot;] %&gt;<br>  auth0_client_id: &lt;%= ENV[&quot;AUTH0_CLIENT_ID&quot;] %&gt;<br>  auth0_client_secret: &lt;%= ENV[&quot;AUTH0_CLIENT_SECRET&quot;] %&gt;</pre><p>4. Add the following gems to your Gemfile :</p><pre>gem &#39;bcrypt&#39;, &#39;~&gt; 3.1.7&#39;<br>gem &#39;dotenv-rails&#39;, groups: [:development, :test]<br>gem &#39;faker&#39;, &#39;~&gt; 1.7.2&#39;<br>gem &#39;rack-cors&#39;,&#39;~&gt;0.4.1&#39;<br>gem &#39;active_model_serializers&#39;, &#39;~&gt; 0.10.0&#39;<br>gem &#39;knock&#39;, &#39;~&gt; 2.0&#39;</pre><p>5. Run bundle install</p><p>6. Create a user model, run rails g model User name email password_digest</p><p>7. Create and migrate your postgres database, run rails db:create &amp;&amp; rails db:migrate</p><p>8. In the User model , add the following code snippet:</p><pre># app/models/user.rb</pre><pre>class User &lt; ApplicationRecord<br>  has_secure_password</pre><pre>  def self.from_token_payload payload<br>    payload[&#39;sub&#39;]<br>  end</pre><pre>end</pre><p>9. Install the gem knock by running rails g knock:install</p><p>10. In application controller, add the following code snippet to include theknock gem. This updates knock&#39;s default error message when a user tries to fetch data from a controller that requires authentication.</p><pre># app/controllers/application_controller.rb<br><br>class ApplicationController &lt; ActionController::API  <br>  include Knock::Authenticable</pre><pre>  private</pre><pre>  # Define unauthorized access json response<br>      def unauthorized_entity(entity_name)<br>          render json: { error: &quot;Unauthorized request&quot; }, status:     <br>          :unauthorized<br>      end</pre><pre>end</pre><p>11. Now we will create two controllers called home and profile. The home controller will be used to ping the API server <em>without a JWT</em>, whereas the profiles controller would <em>require a valid JWT </em>to fetch data.</p><p>12. Run rails g controller Home</p><p>13. Runrails g scaffold profile first_name:string last_name:string middle_name:string username:string email:string address:string phone:string profession:string abn:string</p><p>14. Run rails db:migrate</p><p>13. In your home controller, add the following code snippet. The API server will respond with a simple message when the API server is called.</p><pre># app/controllers/home_controller.rb</pre><pre>class HomeController &lt; ApplicationController</pre><pre>  def index<br>     render json: { message: &quot;Welcome to a simple API server with <br>      Auth0&quot;}<br>  end</pre><pre>end</pre><p>14. In your profiles controller , add before_action :authenticate_user to the controller. Any API calls to profiles will require authentication.</p><pre># app/controllers/profiles_controller.rb</pre><pre>class ProfilesController &lt; ApplicationController<br>  ...<br>  before_action :authenticate_user</pre><pre># GET /profiles<br>  def index<br>  ...<br>  end</pre><pre>  ....<br>end</pre><p>16. To enable cross-origin requests, uncomment the following block of code in config/initializers/cors.rb . Ensure that any origin is allowed in this case. (ie : origins &#39;*&#39; )</p><pre>#config/initializers/cors.rb</pre><pre>Rails.application.config.middleware.insert_before 0, Rack::Cors do<br>  allow do<br>    origins &#39;*&#39;</pre><pre>resource &#39;*&#39;,<br>      headers: :any,<br>      methods: [:get, :post, :put, :patch, :delete, :options, :head]<br>  end<br>end</pre><p>17. We need to configure knock to use <a href="https://auth0.com/">Auth0</a> credentials. Uncomment the following code in config/initializers/knock.rb</p><pre># config/initializers/knock.rb</pre><pre>config.token_audience = -&gt; { Rails.application.secrets.auth0_client_id }</pre><pre># DO NOT USE THE DEFAULT CONFIG <br># config.token_secret_signature_key = -&gt; { JWT.base64url_decode Rails.application.secrets.auth0_client_secret }</pre><pre># USE THIS INSTEAD<br>config.token_secret_signature_key = -&gt; { Rails.application.secrets.auth0_client_secret }</pre><blockquote>Note : knock assumes Auth0’s client secret is base64 encoded but as of writing it isn’t. Therefore we need do not need to decode it as shown in the comment code block above.</blockquote><p>18. We need to configure our routes. Ensure in the config/routes.rb has the following code snippet</p><pre>#config/routes.rb   </pre><pre>Rails.application.routes.draw do<br>  resources :profiles<br>  root &#39;home#index&#39;</pre><pre>end</pre><p>19. Lastly, lets add some fake data to simulate a list of profiles. In your db/seeds.rb file, add the following code snippet.</p><pre>#db/seeds.rb</pre><pre>10.times do |i|<br>    first_name  = Faker::Name.first_name<br>    last_name   = Faker::Name.last_name<br>    middle_name = Faker::Name.name_with_middle<br>    username    = Faker::Internet.user_name(first_name + &quot; &quot; + last_name, %w(. _ -))<br>    email       = Faker::Internet.free_email(first_name + &quot;-&quot; + last_name)<br>    phone       = Faker::PhoneNumber.cell_phone<br>    profession  = Faker::Company.profession<br>    abn         = Faker::Company.australian_business_number</pre><pre>Profile.create!(<br>        first_name:     first_name,<br>        last_name:      last_name,<br>        middle_name:    middle_name,<br>        username:       username ,<br>        email:          email,<br>        phone:          phone,<br>        profession:     profession,<br>        abn:            abn,<br>    )<br>end</pre><p>20. Run rails db:seed to populate our profiles database</p><p>21. Now we are done setting up the Rails server ! Lets fire it up and see if its working. Ensure postgresapp is running in the background. Start the rails API server by runingrails s.</p><p>22. Now, we need to get a <strong>JSON Web Token (JWT) </strong>from <a href="https://auth0.com/">Auth0</a>. Start Postman, and send a POST request to <a href="https://_your_auth0_domain_.com/oauth/ro">https://_your_auth0_domain_.com/oauth/ro</a> with the following in the body as JSON</p><pre>{<br>  &quot;client_id&quot;: &quot;___YOUR AUTH0 CLIENT ID___&quot;,<br>  &quot;username&quot;: &quot;<a href="/service/mailto:admin@admin.com">admin@admin.com</a>&quot;,<br>  &quot;password&quot;: &quot;admin&quot;,<br>  &quot;connection&quot;: &quot;___YOUR AUTH0 DATABASE___&quot;,<br>  &quot;scope&quot;: &quot;openid&quot;<br>}</pre><p>23. You should get a response with id_token. That will serve as your JWT for authentication next. Copy it down.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*1oV7UJ7vLG9M_twQDGqT7A.png" /><figcaption>Copy id_token to be used in the next step</figcaption></figure><p>24. Assuming your Rails API server is running on localhost:3000, use Postman again to send a GET request to localhost:3000 .You should receive a response similar to the figure below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*GJkgTdg3JFOpnmxWZTZYUg.png" /><figcaption>You should receive a response as shown in the above figure</figcaption></figure><p>25. Now lets test an authenticated route — the profiles controller. In Postman, send a GET request to localhost:3000/profiles with Authorization : Bearer __your id_token in step 23__ . You should receive a response similar to the figure below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/1*NwyX8r5yHes5PO-6oH4vww.png" /></figure><p>26. That’s it ! We now have a simple API server up and running !</p><p>Next, we will use React as our front-end framework to replace the functionality of Postman from step 22 to 26.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*rkjWw9RMcg9CYh8fNImmGA.jpeg" /></figure><h3>FRONT END — React</h3><h4>Prerequisites, tools and items needed</h4><ol><li>My react boilerplate : <a href="https://github.com/iankhor/react-vanilla-boilerplate-with-router">react-vanilla-boilerplate-with-router</a></li><li><a href="https://github.com/mzabriskie/axios">Axios</a> (to perform fetch request to the Rails API server)</li><li>React Bootstrap 4 — <a href="https://github.com/reactstrap/reactstrap">reactstrap</a></li><li><a href="https://www.bootstrapcdn.com/fontawesome/">Font Awesome</a></li><li>React front-end to run on localhost:9000</li></ol><h4>Steps</h4><ol><li>In your terminal, run git clone <a href="https://github.com/iankhor/react-vanilla-boilerplate-with-router">https://github.com/iankhor/react-vanilla-boilerplate-with-router</a> react-auth0-api</li><li>Remove existing git repository and remotes from Step 1 by running `git remote rm origin &amp;&amp; rm -rf .git .You can add your own git repository from here on if you desired.</li><li>In your root directory of react-auth0-api folder, run cp .env.example .env</li><li>Ensure in the .env file, the following environment variables are populated. An example would be :</li></ol><pre>REACT_APP_API_URL=<a href="https://ror-autho-api.herokuapp.com/">http://localhost:3000</a><br>REACT_APP_AUTH0_CLIENT_ID=___YOUR AUTH0 CLIENT ID___<br>REACT_APP_AUTH0_DOMAIN=___YOUR AUTH0 DOMAIN____</pre><p>4. Install all packages required by the boilerplate by running npm i</p><p>5. Now lets install all the other packages. Run the following:</p><pre>npm i auth0-lock --save</pre><pre>npm i axios --save</pre><pre>npm i bootstrap@4.0.0-alpha.6 --save</pre><pre>npm i --save reactstrap react-addons-transition-group react-addons-css-transition-group</pre><p>6. We will use a spinner icon to simulate a loading component using icons from Font Awesome. Get the CDN html link from <a href="https://www.bootstrapcdn.com/fontawesome/">https://www.bootstrapcdn.com/fontawesome/</a> and paste the code snippet between the &lt;head&gt; tag in the public/index.html file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*si5S6S8XAHv9Kmzhma6e-g.png" /></figure><p>8. To ensure bootstrap CSS is carried over, ensure the bootstrap.css is imported in src/components/index.js</p><pre>#src/components/index.js</pre><pre>import &#39;bootstrap/dist/css/bootstrap.css&#39;</pre><p>7. We will use <a href="https://auth0.com/">Auth0</a>’s own Lock widget (auth0-lock) to sign in/up users. In the public/index.html file, ensure the following code snippet is between the &lt;head&gt; tags to ensure the <a href="https://auth0.com/">Auth0</a> Lock widget will work on mobile devices</p><pre>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0&quot;/&gt;</pre><p>8. Your public/index.html file should look something like this now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rq6V3jc1fwZT65OXy6A9zA.png" /></figure><p>9. In src/utils, create a file called init.js and add the following code snippet. This is the initialisation methods for <a href="https://auth0.com/">Auth0</a> and Axios.</p><pre>import AuthService from &#39;./AuthService&#39;<br>import axios from &#39;axios&#39;</pre><pre>export const auth = new AuthService(<br>                    process.env.REACT_APP_AUTH0_CLIENT_ID, <br>                    process.env.REACT_APP_AUTH0_DOMAIN)</pre><pre>export const api = axios.create({<br>                  baseURL: process.env.REACT_APP_API_URL<br>                  })</pre><p>10. In src/utils, create a file called AuthService.js and add the following code snippet. These are helper methods to use <a href="https://auth0.com/">Auth0</a>.</p><pre>import Auth0Lock from &#39;auth0-lock&#39;<br>import logo from &#39;./../../assets/img/logo.svg&#39;</pre><pre>export default class AuthService {<br>  constructor(clientId, domain) {<br>    // Configure Auth0<br>    this.lock = new Auth0Lock(clientId, domain, {<br>      auth: {<br>        redirectUrl: `${window.location.origin}/auth`,<br>        responseType: &#39;token&#39;<br>      },<br>      theme: {<br>        logo: logo,<br>        primaryColor: &#39;#7FDBFF&#39;<br>      },<br>      languageDictionary: {<br>        title: &quot;React + Auth0 + Rails API&quot;<br>      }<br>    })<br>    // Add callback for lock `authenticated` event<br>    this.lock.on(&#39;authenticated&#39;, this._doAuthentication.bind(this))<br>    // binds login functions to keep this context<br>    this.login = this.login.bind(this)<br>  }</pre><pre>_doAuthentication(authResult) {<br>    // Saves the user token<br>    this.setToken(authResult.idToken)<br>    // navigate to the home route</pre><pre>    location.replace(&quot;/&quot;);</pre><pre>}</pre><pre>login() {<br>    // Call the show method to display the widget.<br>    this.lock.show()<br>  }</pre><pre>loggedIn() {<br>    // Checks if there is a saved token and it&#39;s still valid<br>    return !!this.getToken()<br>  }</pre><pre>setToken(idToken) {<br>    // Saves user token to local storage<br>    localStorage.setItem(&#39;id_token&#39;, idToken)<br>  }</pre><pre>getToken() {<br>    // Retrieves the user token from local storage<br>    return localStorage.getItem(&#39;id_token&#39;)<br>  }</pre><pre>logout() {<br>    // Clear user token and profile data from local storage<br>    localStorage.removeItem(&#39;id_token&#39;);</pre><pre>    location.replace(&quot;/&quot;);<br>  }<br>}</pre><p>11. In src/utils, create a file called API.js and add the following code snippet. These are helper methods to fetch and ping the Rails API server.</p><pre>import { api } from &#39;./init&#39;</pre><pre>export function pingApiServer(){<br>    return api.get(&#39;/&#39;)<br>        .then(function (response) {<br>            return response.data<br>        })<br>        .catch(function (error) {<br>            return error.response.data<br>        })<br>}</pre><pre>export function fetchProfilesNoAuth(){<br>    return api.get(&#39;/profiles&#39;)<br>        .then(function (response) {<br>            return response.data<br>        })<br>        .catch(function (error) {<br>            return error.response.data<br>        })<br>}</pre><pre>export function fetchProfilesWithAuth(token){<br>    return api.get(&#39;/profiles&#39;, { headers: { &#39;Authorization&#39;: &#39;Bearer &#39; + token } })<br>        .then(function (response) {<br>            return response.data<br>        })<br>        .catch(function (error) {<br>            return error.response.data<br>        })<br>}</pre><p>12. Update App.js in src/components with the following code snippet</p><pre>import React, { Component } from &#39;react&#39;;<br>import logo from &#39;../../assets/img/logo.svg&#39;<br>import &#39;../css/style.css&#39;<br>import Home from &#39;./Home&#39;<br>import { auth } from &#39;./../utils/init&#39;</pre><pre>class App extends Component {<br>  constructor(props){<br>      super(props)</pre><pre>this.state = {<br>          isLoggedIn: auth.loggedIn(),<br>      }<br>  }</pre><pre>render() {<br>    return (<br>        &lt;div className=&quot;App&quot;&gt;<br>          &lt;div className=&quot;App-header&quot;&gt;<br>            &lt;img src={logo} className=&quot;App-logo&quot; alt=&quot;logo&quot; /&gt;<br>            &lt;h2&gt;Welcome to React + Auth0 + Rails API&lt;/h2&gt;<br>          &lt;/div&gt;</pre><pre>&lt;Home <br>            auth={auth}<br>            isLoggedIn={ this.state.isLoggedIn }<br>            token={auth.getToken()}<br>          /&gt;</pre><pre>&lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default App;</pre><p>13. Create three components files in src/components and named them Home.js , LoginTransition.js and Loading.js</p><p>14. Paste the following code snippet to Home.js</p><pre>//src/components/Home.js</pre><pre>import React, { Component } from &#39;react&#39;<br>import JSONDebugger from &#39;../utils/JSONDebugger&#39;<br>import { pingApiServer, <br>        fetchProfilesWithAuth, <br>        fetchProfilesNoAuth } from &#39;./../utils/API&#39;<br>import { Container,<br>         Row,<br>         Col,<br>         Button, <br>         ButtonGroup } from &#39;reactstrap&#39;</pre><pre>import Loading from &#39;./Loading&#39;</pre><pre>class Home extends Component {<br>    constructor(props){<br>        super(props)</pre><pre>this.state = {  status: &quot;Idle&quot;,<br>                        pingData: &quot;No data from server yet&quot;,<br>                        profileData: &quot;No data from server yet&quot;<br>                    }<br>    }</pre><pre>resetStates = () =&gt; {<br>        this.setState({<br>            status: &quot;Idle&quot;,<br>            pingData: &quot;No data from server yet&quot;,<br>            profileData: &quot;No data from server yet&quot;<br>            })<br>    }</pre><pre>renderLoading = () =&gt; {<br>        switch(this.state.status) {<br>            case &quot;Fetching&quot;:<br>                return &lt;Loading /&gt;<br>            default:<br>                return null<br>        }<br>    }</pre><pre>pingApi = () =&gt; {<br>        this.setState( { status: &quot;Fetching&quot; })<br>        pingApiServer()<br>        .then( data =&gt; {<br>            this.setState({ status: &quot;Fetch completed&quot;, pingData: data} )<br>        } )<br>    }<br> <br>    _fetchProfilesNoAuth = () =&gt; {<br>        this.setState( { status: &quot;Fetching&quot; })<br>        fetchProfilesNoAuth()<br>        .then( data =&gt; {<br>            this.setState({ status: &quot;Fetch completed&quot;, profileData: data} )<br>        })<br>    }</pre><pre>_fetchProfilesWithAuth = () =&gt; {<br>        this.setState( { status: &quot;Fetching&quot; })<br>        fetchProfilesWithAuth(this.props.token)<br>        .then( data =&gt; {<br>            this.setState({ status: &quot;Fetch completed&quot;, profileData: data} )<br>        })<br>    }</pre><pre>renderSignInUp = () =&gt; {<br>        return &lt;Button color=&quot;primary&quot; onClick={ this.props.auth.login }&gt;Sign In / Sign Up&lt;/Button&gt;<br>    }</pre><pre>renderLogOut = () =&gt; {<br>        return (<br>            &lt;div&gt;<br>                &lt;Row&gt;<br>                    &lt;Col&gt;<br>                        &lt;Button color=&quot;primary&quot; onClick={ this.props.auth.logout}&gt;Sign out&lt;/Button&gt;<br>                        &lt;Button color=&quot;secondary&quot; onClick={ this.pingApi }&gt;Ping API Server&lt;/Button&gt;<br>                    &lt;/Col&gt;<br>                &lt;/Row&gt;<br>                &lt;Row&gt;<br>                    &lt;Col xs=&quot;12&quot; sm=&quot;6&quot;&gt;<br>                        &lt;Button color=&quot;danger&quot; onClick={this._fetchProfilesNoAuth }&gt;Fetch Profile without Authentication&lt;/Button&gt;<br>                    &lt;/Col&gt;<br>                    &lt;Col xs=&quot;12&quot; sm=&quot;6&quot;&gt;<br>                        &lt;Button color=&quot;success&quot; onClick={ this._fetchProfilesWithAuth }&gt;Fetch Profile with Authentication&lt;/Button&gt;<br>                    &lt;/Col&gt;<br>                &lt;/Row&gt;<br>                &lt;Row&gt;<br>                    &lt;Col&gt;<br>                        &lt;Button outline color=&quot;danger&quot; size=&quot;sm&quot; onClick={ this.resetStates }&gt;Reset&lt;/Button&gt;<br>                    &lt;/Col&gt;<br>                &lt;/Row&gt;<br>            &lt;/div&gt;<br>        )<br>    }</pre><pre>render(){<br>        return(<br>            &lt;Container&gt;<br>                &lt;div className=&quot;buttons&quot;&gt;<br>                    &lt;ButtonGroup vertical&gt;<br>                        { this.props.isLoggedIn ? this.renderLogOut() : this.renderSignInUp() }<br>                    &lt;/ButtonGroup&gt;<br>                &lt;/div&gt; <br>                { this.renderLoading() }<br>                { &lt;JSONDebugger json={this.state} /&gt; }<br>            &lt;/Container&gt;<br>        )<br>    }<br>}</pre><pre>export default Home</pre><p>15. Paste the following code snippet to LoginTransition.js</p><pre>//src/components/LoginTransition.js</pre><pre>import React, { Component } from &#39;react&#39;<br>import { Container, Row, Col } from &#39;reactstrap&#39;<br>import Loading from &#39;./Loading&#39;</pre><pre>class LoginTransition extends Component {<br>    render(){<br>        return(<br>            &lt;Container className=&quot;login-transition&quot;&gt;<br>                &lt;Row&gt;<br>                    &lt;Col&gt; <br>                        &lt;Loading /&gt;<br>                    &lt;/Col&gt;<br>                &lt;/Row&gt;<br>            &lt;/Container&gt;<br>            <br>        )<br>    }<br>}</pre><pre>export default LoginTransition</pre><p>16. Paste the following code snippet to Loading.js</p><pre>//src/components/Loading.js</pre><pre>import React from &#39;react&#39;</pre><pre>const Loading = (props) =&gt; {<br>        return (<br>          &lt;div&gt;<br>             &lt;i className=&#39;fa fa-spinner fa-spin fa-5x color-font-aqua&#39;&gt;&lt;/i&gt;<br>          &lt;/div&gt;<br>        )<br>}</pre><pre>export default Loading</pre><p>17. We will also need to update some of our CSS as well. In src/css/style.styl . Replace the existing CSS entires the following code snippet. Do not update the style.css file. The scripts in the boilerplate will look after that.</p><pre>//src/css/style.styl</pre><pre>h1<br>  font-size 2em</pre><pre>.color-silver<br>  background-color #DDDDDD</pre><pre>.color-font-aqua<br>  color #7FDBFF</pre><pre>.color-aqua<br>  background-color #7FDBFF</pre><pre>.generic-center<br>  margin auto<br>  padding 2rem<br>  border 2px solid #000<br>  text-align center</pre><pre>.dummy-height <br>  min-height 500px</pre><pre>.border<br>  border 2px solid #000</pre><pre>.buttons<br>  border 2px solid #000<br>  padding 20px</pre><pre>.borderless <br>  border none</pre><pre>// App.css<br>.App <br>  text-align center</pre><pre>.App-logo <br>  animation App-logo-spin infinite 20s linear<br>  height 80px</pre><pre>.App-header <br>  height 150px<br>  padding 20px</pre><pre>.App-intro <br>  font-size large</pre><pre>.login-transition<br>  text-align center<br>  padding-top 50vh</pre><pre>.debugger<br>  text-align left</pre><pre><a href="http://twitter.com/keyframes">@keyframes</a> App-logo-spin <br>  from { transform: rotate(0deg) }<br>  to { transform: rotate(360deg) }</pre><p>18. Lastly, update src/components/shared/Routes.jswith the following code snippet:</p><pre>//src/components/shared/Routes.js</pre><pre>import React from &#39;react&#39;</pre><pre>//Routes<br>import NotFound from &#39;./NotFound&#39;<br>import App from &#39;./../App&#39;;<br>import LoginTransition from &#39;./../LoginTransition&#39;;</pre><pre>import { BrowserRouter, Route, Switch } from &#39;react-router-dom&#39;</pre><pre>const Routes = (props) =&gt; {<br>  return (<br>    &lt;BrowserRouter&gt;<br>      &lt;Switch&gt;<br>        &lt;Route path=&quot;/&quot; exact component={App} /&gt;  <br>        &lt;Route path=&quot;/auth&quot; exact component={LoginTransition} /&gt;  <br>        &lt;Route component={NotFound} /&gt;  <br>      &lt;/Switch&gt;<br>    &lt;/BrowserRouter&gt;<br>  )<br>}</pre><pre>export default Routes</pre><p>18. Just one more step to setup in <a href="https://auth0.com/">Auth0</a>. Log into your <a href="https://auth0.com/">Auth0</a> account. Navigate to Clients on the left menu panel. Click on the client ID that you have used for the Rails API Server. Under settings, ensure <strong>Allowed Callback URLs</strong> include:</p><pre><a href="http://localhost:9000/">http://localhost:9000</a> <br>http://localhost:9000/auth</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*OoH9qizgtW4wa6wBCff1kA.png" /><figcaption>Ensure <a href="http://localhost:9000/">http://localhost:9000</a> and <a href="http://localhost:9000/auth">http://localhost:9000/auth</a> is included under Allowed Callback URL</figcaption></figure><p>18. Now, we are ready to test our React front-end to see if it would interact with our Rails API server.</p><p>19. In your terminal, run npm run watch</p><p>20. In your favourite browser, navigate to localhost:9000 and click on the <strong>Sign In / Sign Up </strong>button. Sign in with the username admin@admin.com and password admin (Note: as mentioned earlier, it is assumed you have set a dummy username and password)</p><p>21. You can now play around with all the buttons as shown in the gif below !</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*QDNFxd1xpqQ7K_9CdrwYdA.gif" /><figcaption>React + Auth0 + Rails API demo</figcaption></figure><p>If you run into issues in any of the steps, it is a good exercise to try to debug it on your own. I have an publication that suggests a couple of ways to problem solve issues <a href="https://medium.com/devtechtipstricks/my-personal-top-10-art-of-debugging-problems-in-software-12fb0a01832#.meyce1wan">here</a> which may help.</p><p>Hope this little write up would give you a starting point for your app and some learning at the same time !</p><p>And till next time … Keep hacking !</p><h3>References</h3><ul><li><a href="https://www.pluralsight.com/guides/ruby-ruby-on-rails/token-based-authentication-with-ruby-on-rails-5-api">https://www.pluralsight.com/guides/ruby-ruby-on-rails/token-based-authentication-with-ruby-on-rails-5-api</a></li><li><a href="http://www.thegreatcodeadventure.com/jwt-authentication-with-rails-ember-part-i-rails-knock/">http://www.thegreatcodeadventure.com/jwt-authentication-with-rails-ember-part-i-rails-knock/</a></li><li><a href="https://auth0.com/docs/quickstart/backend/rails">https://auth0.com/docs/quickstart/backend/rails</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=257cbb2a939a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devtechtipstricks/build-a-simple-rails-api-server-auth0-jwt-authentication-react-from-scratch-in-30-minutes-or-257cbb2a939a">Build a simple Rails API server + Auth0 JWT authentication + React from scratch in 30 minutes (or…</a> was originally published in <a href="https://medium.com/devtechtipstricks">dev &lt;tech&gt; tips &amp; tricks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 3 of 3 —…]]></title>
            <link>https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-3-of-3-b12c08cf96a9?source=rss----6c80a8cb2e89---4</link>
            <guid isPermaLink="false">https://medium.com/p/b12c08cf96a9</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[heroku]]></category>
            <dc:creator><![CDATA[Ian Khor]]></dc:creator>
            <pubDate>Mon, 20 Feb 2017 11:59:53 GMT</pubDate>
            <atom:updated>2017-02-20T12:23:13.048Z</atom:updated>
            <content:encoded><![CDATA[<h3>A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 3 of 3 — Deployment)</h3><p>This is the last of a 3 part publication on how to setup a simple login/signup platform. <a href="https://medium.com/@iankhorbc.thecoder/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-2-or-3-react-7de3818862ce#.lkedz0icc">Previously</a>, we have setup the Auth0/Heroku environment and also dived into some React code. Now its time to deploy it to Heroku !</p><p>This is the home stretch. Do you smell victory ?</p><p>Assuming you have signed up to <a href="http://www.heroku.com/">Heroku</a>, now its time set it up on your terminal so you could deploy it live.</p><ol><li>In your favourite terminal (I use VS Code), go to your folder and in our case</li></ol><pre>cd your-app-name</pre><p>2. We need to log in to heroku via your terminal, run the following :</p><pre>heroku login</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/476/1*kf2pJlfoFdAdP9RW0XL-kQ.png" /><figcaption>Log into heroku in your terminal</figcaption></figure><p>3. Setup heroku as one of the git remote. Remember we noted down <strong>Heroku’s Git URL</strong> in Step 12 of the heroku setup ? Run the following</p><pre>git remote add heroku <a href="https://git.heroku.com/react-auth0-example.git">https://git.heroku.com/YOUR-HEROKU-GIT.git</a><br>git remote -v</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*E3m9SdYgCIpmVsItUQJk-Q.png" /></figure><p>4. Lastly .. the moment we all have been waiting for … DEPLOYMENT ! Finally run</p><pre>git push heroku master</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*EXRIGIV5Hpt2XPsYFh98cg.png" /></figure><p>After running the above, you should see heroku building/installing the app and you can access your app at the end of the log.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*Gd5kf2qReCx9d8-DCo4bHA.png" /></figure><p>And now its time for celebrations and give yourself a pat on the back for reaching this point !</p><p>The completed example can be found <a href="http://-auth0-example.herokuapp.com/">here</a>.</p><p>And if you need the source code, go to my github <a href="https://github.com/iankhor/react-auth0-example">here</a> to check it out.</p><blockquote>Note that there are <a href="https://auth0.com/docs/connections/database/rate-limits">rate limits on the auth0 API calls </a>and if you log in too many times when testing, chances are you have exceed that limit.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*kb8_s9qW2NmHhZtLtDapww.png" /></figure><p>If you run into issues in any of the steps, it is a good exercise to try to debug it on your own. I have an publication that suggests a couple of ways to problem solve issues <a href="https://medium.com/devtechtipstricks/my-personal-top-10-art-of-debugging-problems-in-software-12fb0a01832#.meyce1wan">here</a> which may help.</p><p>Hope this little write up would enable you to move forward in creating your amazing apps !</p><p>And till next time … Keep hacking !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b12c08cf96a9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-3-of-3-b12c08cf96a9">A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 3 of 3 —…</a> was originally published in <a href="https://medium.com/devtechtipstricks">dev &lt;tech&gt; tips &amp; tricks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 2 or 3 — React)]]></title>
            <link>https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-2-or-3-react-7de3818862ce?source=rss----6c80a8cb2e89---4</link>
            <guid isPermaLink="false">https://medium.com/p/7de3818862ce</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Ian Khor]]></dc:creator>
            <pubDate>Mon, 20 Feb 2017 11:59:40 GMT</pubDate>
            <atom:updated>2017-02-21T14:36:22.338Z</atom:updated>
            <content:encoded><![CDATA[<p>In the <a href="https://medium.com/@iankhorbc.thecoder/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-1-of-3-setup-18fa929e2cd7#.3kmfjkagy">previous article</a>, we have dealt with setting up the Auth0 and Heroku environment. Now its time to dive into some React code !</p><h3><strong>React</strong></h3><ol><li>Use the boilerplate source code which i’ve created <a href="https://github.com/iankhor/react-vanilla-boilerplate-with-router"><strong>here</strong></a> by running</li></ol><pre>git clone <a href="https://github.com/iankhor/react-vanilla-boilerplate-with-router">https://github.com/iankhor/react-vanilla-boilerplate-with-router</a> your-app-name</pre><p>2. Go into your app folder, and in our case would be</p><pre>cd your-app-name</pre><p>3. Install all existing node modules by running</p><pre>npm i</pre><p>5. Install Auth0 and jwt-decode by running</p><pre>npm i auth0-js jwt-decode --save</pre><p>5. Copy over the example environmental variables file to <strong>.env </strong>by running</p><pre>cp .env.example .env</pre><p>6. In the <strong>.env </strong>file, create two environmental variables called <strong>REACT_APP_AUTH_DOMAIN_ADDRESS</strong> and <strong>REACT_APP_AUTH_CLIENT_ID. </strong>Populate the <strong>domain ID </strong>and <strong>client ID</strong> as noted in <strong>auth0 setup Step 12.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*WW77xlV7CUV3XBclJp5JLQ.png" /></figure><p>7. The following steps are similar to the Auth0 React tutorial <a href="https://auth0.com/docs/quickstart/spa/react/02-custom-login">here</a> but modified for our purposes.</p><p>8. Under the folder <strong>src</strong>, create a subfolder called <strong>auth</strong> and three files named <strong>initAuth.js</strong>, <strong>AuthService.js </strong>and <strong>jwtHelper.js</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/257/1*uSqfMB1wqIOvN2v3xZCUvw.png" /></figure><p>7. In <strong>jwtHelper.js</strong>, copy and paste the following code and save. This is the helper file for auth0.</p><pre>import decode from ‘jwt-decode’;</pre><pre>export function getTokenExpirationDate(token){<br> const decoded = decode(token)<br> if(!decoded.exp) {<br> return null<br> }</pre><pre>const date = new Date(0) // The 0 here is the key, which sets the date to the epoch<br> date.setUTCSeconds(decoded.exp)<br> return date<br>}</pre><pre>export function isTokenExpired(token){<br> const date = getTokenExpirationDate(token)<br> if (date === null) {<br> return false<br> }<br> return !(date.valueOf() &gt; new Date().valueOf())<br>}</pre><p>7. In <strong>AuthService.js</strong>, copy and paste the following code and save.</p><pre>import { EventEmitter } from &#39;events&#39;<br>import { isTokenExpired } from &#39;./jwtHelper&#39;<br>import auth0 from &#39;auth0-js&#39;</pre><pre>export default class AuthService extends EventEmitter {<br>  constructor(clientId, domain) {<br>    super()<br>    // Configure Auth0<br>    this.auth0 = new auth0.WebAuth({<br>      clientID: clientId,<br>      domain: domain,<br>      responseType: &#39;token id_token&#39;,<br>      redirectUri: `${window.location.origin}/`<br>    })</pre><pre>this.login = this.login.bind(this)<br>    this.signup = this.signup.bind(this)<br>    this.loginWithGoogle = this.loginWithGoogle.bind(this)<br>  }</pre><pre>login(username, password) {<br>    this.auth0.client.login({<br>      realm: &#39;react-auth0&#39;,<br>      username,<br>      password<br>    }, (err, authResult) =&gt; {<br>      if (err) {<br>        alert(&#39;Error: &#39; + err.description)<br>        return<br>      }<br>      if (authResult &amp;&amp; authResult.idToken &amp;&amp; authResult.accessToken) {<br>        this.setToken(authResult.accessToken, authResult.idToken)<br>        window.location = window.location.origin //redirect to main page<br>      }<br>    })<br>  }</pre><pre>signup(email, password){<br>    this.auth0.redirect.signupAndLogin({<br>      connection: &#39;react-auth0&#39;,<br>      email,<br>      password,<br>    }, function(err) {<br>      if (err) {<br>        alert(&#39;Error: &#39; + err.description)<br>      }<br>    })<br>  }</pre><pre>loginWithGoogle() {<br>    this.auth0.authorize({<br>      connection: &#39;google-oauth2&#39;,<br>    })<br>  }</pre><pre>parseHash(hash) {<br>    this.auth0.parseHash({ hash }, (err, authResult) =&gt; {<br>      if (authResult &amp;&amp; authResult.accessToken &amp;&amp; authResult.idToken) {<br>        this.setToken(authResult.accessToken, authResult.idToken)<br>        console.log(&#39;AuthService parseHash : code to transition to /&#39;)<br>        this.auth0.client.userInfo(authResult.accessToken, (error, profile) =&gt; {<br>          if (error) {<br>            console.log(&#39;Error loading the Profile&#39;, error)<br>          } else {<br>            this.setProfile(profile)<br>          }<br>        })<br>      } else if (authResult &amp;&amp; authResult.error) {<br>        alert(&#39;Error: &#39; + authResult.error)<br>      }<br>    })<br>  }</pre><pre>loggedIn() {<br>    // Checks if there is a saved token and it&#39;s still valid<br>    const token = this.getToken()<br>    return !!token &amp;&amp; !isTokenExpired(token)<br>  }</pre><pre>setToken(accessToken, idToken) {<br>    // Saves user access token and ID token into local storage<br>    localStorage.setItem(&#39;access_token&#39;, accessToken)<br>    localStorage.setItem(&#39;id_token&#39;, idToken)<br>  }</pre><pre>setProfile(profile) {<br>    // Saves profile data to localStorage<br>    localStorage.setItem(&#39;profile&#39;, JSON.stringify(profile))<br>    // Triggers profile_updated event to update the UI<br>    this.emit(&#39;profile_updated&#39;, profile)<br>  }</pre><pre>getProfile() {<br>    // Retrieves the profile data from localStorage<br>    const profile = localStorage.getItem(&#39;profile&#39;)<br>    return profile ? JSON.parse(localStorage.profile) : {}<br>  }</pre><pre>getToken() {<br>    // Retrieves the user token from localStorage<br>    return localStorage.getItem(&#39;id_token&#39;)<br>  }</pre><pre>logout() {<br>    // Clear user token and profile data from localStorage<br>    localStorage.removeItem(&#39;id_token&#39;)<br>    localStorage.removeItem(&#39;profile&#39;)<br>  }<br>}</pre><p>8. In <strong>initAuth.js</strong>, copy and paste the following code and save. This is a helper file to create an auth0 instance.</p><pre>import AuthService from ‘./AuthService’</pre><pre>const auth = new AuthService(process.env.REACT_APP_AUTH_CLIENT_ID, process.env.REACT_APP_AUTH_DOMAIN_ADDRESS)</pre><pre>export default auth</pre><p>9. We are going to create the sign up and log in components. create two files called <strong>SignUp.js </strong>and <strong>Login.js</strong> in the components folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/233/1*v_6yaYZiVVNi9WcIsFB-Tg.png" /></figure><p>10. In <strong>SignUp.js</strong>, copy and paste the following code and save.</p><pre>import React, { Component } from &#39;react&#39;<br>import auth from &#39;./../auth/initAuth&#39;</pre><pre>class SignUp extends Component {<br>    constructor(props){<br>        super(props)</pre><pre>this.state = {<br>            email: null,<br>            password: null<br>        }<br>    }<br>    <br>    _handleSubmit = (e, data) =&gt; {<br>        e.preventDefault()<br>        auth.signup(this.state.email, this.state.password)<br>    }</pre><pre>_handleEmailChange = (e) =&gt; {<br>        this.setState( {email: e.target.value} )<br>        console.log(&#39;email&#39;, this.state.email)<br>    }</pre><pre>_handlePasswordChange = (e) =&gt; {<br>        this.setState( {password: e.target.value} )<br>        console.log(&#39;password&#39;, this.state.password)<br>    }</pre><pre>render(){<br>        return(<br>            &lt;form className=&quot;commentForm&quot; onSubmit={this._handleSubmit}&gt;<br>                &lt;input type=&quot;email&quot; placeholder=&quot;Enter your email&quot; onChange={this._handleEmailChange}/&gt;<br>                &lt;input type=&quot;password&quot; placeholder=&quot;Enter a password&quot; onChange={this._handlePasswordChange}/&gt;<br>                &lt;input type=&quot;submit&quot; value=&quot;Sign up&quot; /&gt;<br>            &lt;/form&gt;<br>        )<br>    }<br>}</pre><pre>export default SignUp</pre><p>12. In <strong>Login.js</strong>, copy and paste the following code and save.</p><pre>import React, { Component } from &#39;react&#39;<br>import auth from &#39;./../auth/initAuth&#39;</pre><pre>class Login extends Component {<br>    constructor(props){<br>        super(props)</pre><pre>this.state = {<br>            email: null,<br>            password: null<br>        }<br>    }</pre><pre>_handleSubmit = (e, data) =&gt; {<br>        e.preventDefault()<br>        auth.login(this.state.email, this.state.password)<br>}</pre><pre>_handleEmailChange = (e) =&gt; {<br>        this.setState( {email: e.target.value} )<br>    }</pre><pre>_handlePasswordChange = (e) =&gt; {<br>        this.setState( {password: e.target.value} )<br>    }</pre><pre>_logout = () =&gt; {<br>        auth.logout()<br>        this.props._refresh()<br>    }</pre><pre>_renderLoginForm = () =&gt; {<br>        return(<br>            &lt;form className=&quot;commentForm&quot; onSubmit={this._handleSubmit}&gt;<br>                    &lt;input type=&quot;email&quot; placeholder=&quot;Enter your email&quot; onChange={this._handleEmailChange}/&gt;<br>                    &lt;input type=&quot;password&quot; placeholder=&quot;Enter a password&quot; onChange={this._handlePasswordChange}/&gt;<br>                    &lt;input type=&quot;submit&quot; value=&quot;Login&quot; /&gt;<br>            &lt;/form&gt;<br>        )<br>    }</pre><pre>_renderLogout = () =&gt; {<br>        return(<br>            &lt;div&gt;<br>                &lt;button onClick={ this._logout }&gt;You are logged in ! Click to logout !&lt;/button&gt;<br>            &lt;/div&gt;<br>        )<br>    }</pre><pre>render(){<br>        return(<br>            &lt;div&gt;<br>                { auth.loggedIn() ? this._renderLogout() : this._renderLoginForm() }<br>            &lt;/div&gt;<br>        )<br>    }<br>}</pre><pre>export default Login</pre><p>13. Update the <strong>Routes.js </strong>in the shared folder to create private (or authenticated) pages.</p><pre>import React from &#39;react&#39;<br>import auth from &#39;./../../auth/initAuth&#39;</pre><pre>//Routes<br>import NotFound from &#39;./NotFound&#39;<br>import App from &#39;./../App&#39;;<br>import PageOne from &#39;./../PageOne&#39;</pre><pre>import { BrowserRouter, Route, Switch, Redirect } from &#39;react-router-dom&#39;</pre><pre>const PrivateRoute = ({ component, ...rest }) =&gt; (<br>  &lt;Route {...rest} render={props =&gt; (<br>    auth.loggedIn() ? (<br>      React.createElement(component, props)<br>    ) : (<br>      &lt;Redirect to=&quot;/NotFound&quot; /&gt;<br>    )<br>  )}/&gt;<br>)</pre><pre>const Routes = (props) =&gt; {<br>  return (<br>    &lt;BrowserRouter&gt;<br>      &lt;Switch&gt;<br>        &lt;Route path=&quot;/&quot; exact component={App} /&gt;  <br>        &lt;PrivateRoute path=&quot;/PageOne&quot; component={PageOne} /&gt;  <br>        &lt;Route path=&quot;/NotFound&quot; component={NotFound} /&gt;  <br>        &lt;Route component={NotFound} /&gt;  <br>      &lt;/Switch&gt;<br>    &lt;/BrowserRouter&gt;<br>  )<br>}</pre><pre>export default Routes</pre><p>Great ! We are nearing the end of our hero’s journey.</p><p>Sit back, relax and when you have ready. Click <a href="https://medium.com/@iankhorbc.thecoder/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-3-of-3-b12c08cf96a9#.ffftjg424">here for the final part</a> of this publication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7de3818862ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-2-or-3-react-7de3818862ce">A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 2 or 3 — React)</a> was originally published in <a href="https://medium.com/devtechtipstricks">dev &lt;tech&gt; tips &amp; tricks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 1 of 3 — Setup)]]></title>
            <link>https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-1-of-3-setup-18fa929e2cd7?source=rss----6c80a8cb2e89---4</link>
            <guid isPermaLink="false">https://medium.com/p/18fa929e2cd7</guid>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Ian Khor]]></dc:creator>
            <pubDate>Mon, 20 Feb 2017 11:59:24 GMT</pubDate>
            <atom:updated>2017-03-23T00:29:02.865Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*XWR9N0LRSPfwF2GtRBCp_w.gif" /><figcaption>Page One is only accessible if a user is logged in (Note : gif may take a minute or so to load)</figcaption></figure><p>I’ve recently been fascinated with React and built a referral platform for a friend’s startup. So I thought I should share my way of quickly setting up a simple login/signup platform with <a href="https://auth0.com/">Auth0</a> and deploying it to Heroku.</p><p>The intention of this guide is for newcomers or startups who wants to quickly bring up a platform to get users. It does not follow any general best practices but serves as a guide to get something up and running up quickly.</p><p>Lastly, this article has been written in a way without detailed explanation why it is done in a certain way. This is not the only way to do things but one of the ways to get some traction on your current project. If you run into any issues, I’d be happy to assist but Google is always your best companion in the digital world.</p><p>I’ve written it in a way for mainly beginners to follow the steps and also it serves as a guide for more advanced users to how to set it up from scratch. The setup process will take approximately 30–45 minutes.</p><p>At the time of writing the following tools/frameworks were used and working.</p><ol><li><a href="https://github.com/iankhor/react-vanilla-boilerplate-with-router/releases/tag/1.0">react-vanilla-boilerplate-router v1.0</a> (boilerplate with create-react-app and react-router 4.0beta0.3)</li><li><a href="https://github.com/auth0/auth0.js/releases/tag/v8.1.2">Auth0.js v8.1.2</a></li><li>Your favourite code editor (I’m using <a href="https://code.visualstudio.com/">VS Code</a>)</li><li><a href="http://www.heroku.com/">Heroku</a></li></ol><blockquote><em>Disclaimer : there will be a routing issue at deployment and if you find it, it is intentionally not covered in this guide.</em></blockquote><p>If you are reading this 1 or 2 years from the time of this article was published, it is highly likely that the following steps could be outdated. I will try to update it as often as I could so tread with caution !</p><h3>SETTING IT ALL UP</h3><h4>Heroku setup</h4><ol><li>Log into your heroku account</li><li>Create a new app</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LX9FQPrlDvu7tBURrdGWeA.png" /></figure><p>3. Go to <strong>Settings</strong> and add the following code under <strong>Buildpacks</strong> to allow us to deploy this react app later.</p><pre><a href="https://github.com/mars/create-react-app-buildpack.git">https://github.com/mars/create-react-app-buildpack.git</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3iFmltzj1ajli9q4mPtDtQ.png" /></figure><p>4. Go to <strong>Overview</strong>, under the <strong>Installed add-ons</strong> section, click on <strong>Configure Add-ons.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*w80s0VdnBjseRaqllhBW1A.png" /></figure><p>5. Search for <strong>mlab</strong>, and hit Enter to add <strong>mlab MongoDB</strong>. (Note: you may need to supply your credit card details to enable this feature. Don’t worry there is a free plan for mLab MongoDB)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWhCVVqeAFRnqTzixNz9MQ.png" /></figure><p>6. Ensure the plan <strong>Sandbox-Free</strong> is selected and click on <strong>Provision</strong> (You could select a paid plan if you want to but for this example we will stick to the free plan)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*Qj6UcNvlqVd8b-aXbBOoFg.png" /></figure><p>7. Almost there ! Go to <strong>Settings</strong>, under <strong>Config Variables</strong>, click on <strong>Reveal Config Vars</strong>.</p><p>8. Copy the <strong>MONGODB_URI</strong> value. It will be used later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SuXCu0ztd3FCNDVvoVSBWw.png" /></figure><blockquote>9. The next few steps, step 10 onwards, are only applicable after you have completed all <a href="https://auth0.com/">Auth0</a> setup steps. So come back to it when you have completed them.</blockquote><p>10. With the <strong>domain ID</strong> and <strong>client ID</strong>, go to <strong>Settings</strong> and click on <strong>Reveal Config Vars</strong>.</p><p>11. Add your <a href="https://auth0.com/">auth0</a> <strong>domain ID and client ID</strong>, as a key-value pair.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UgilAJKomyOlStK7QYOBBw.png" /></figure><p>12. We are nearing the finishing line ! Take note of the <strong>Heroku’s git repository URL</strong>. This will be used later on down the track.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*ui0PZ2FqDlL9tjcUBSduLA.png" /></figure><p>Now your deployment setup should be ready for a launch to Mars !</p><h4>Auth0 setup</h4><ol><li>Go to <a href="https://auth0.com/">auth0.com</a> and sign up for an account.</li><li>Once logged in, go to <strong>Clients</strong> and <strong>Create Client</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5mD0w2BE9MVRJJHl-l4O7g.png" /></figure><p>3. Give your app a name, select <strong>Single Page Web Applications</strong>, and click on <strong>Create.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*BjS8XKcc-SDMN_W3j_JObg.png" /></figure><p>4. Next, from the side menu panel, select <strong>Connections &gt; Database </strong>and click on <strong>Create DB Connection</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xP8Efx6YXweDslaifITJHg.png" /></figure><p>5. Give your database a name and click on <strong>Create</strong>. In this case I’ve named it <strong>react-auth0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*onjGOLOv8yecp2qXLhLzGg.png" /></figure><p>6. Click on <strong>Custom Database</strong>, and toggle <strong>Use my own database</strong> to enable you to use your own custom database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*rb1v0h0UU3bYcqbX7IVyGg.png" /></figure><p>7. Under the <strong>Database Action Scripts</strong> section, with the <strong>Create</strong> tab, select <strong>MongoDB</strong> under the <strong>Templates</strong> drop list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*hR6AXzdmveVk0fbfJZzwaQ.png" /></figure><p>8. Remember <strong>step 8 of the Heroku setup</strong> where you copied the value of <strong>MONGODB_URI </strong>?<strong> </strong>Replace the mongoDB URI in the template. Then click on <strong>Save</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/824/1*MhgXpfUuxwNfp2sPFtyVlg.png" /></figure><p>9. Test the script by clicking on <strong>Try</strong></p><p>10. Enter a email and password to create an account. If successful, you should see a confirmation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*chAOIayA5MD_23W-m9Li0g.png" /><figcaption>Enter an email and password</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*qu1sE2-aNjEeLGLuLfaWpw.png" /><figcaption>User created !</figcaption></figure><p>10. Lastly, repeat steps 7 to 9 with the remaining tabs : Login, Verify, Change Password and Delete. (You can ignore the tab Get User for now)</p><p>11. We are almost there. Now to hook up your <a href="https://auth0.com/">Auth0</a> client with the custom database ! In your side menu panel, click on <strong>Clients</strong> and <strong>select the client </strong>created in Step 2 called <strong>react-auth0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*IZ2GmaQ07oYDjhxa5GAlEg.png" /></figure><p>12. Select the <strong>Settings</strong> tab (it is right under the name of the name of the app name). Take note of the <strong>client ID </strong>and <strong>Domain </strong>as this will serve as your environment variables in Heroku.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*aNgGH2C9HecmeZc51wBprA.png" /></figure><p>13. In the callback URLs enter <a href="http://localhost:9000/"><strong>http://localhost:9000/</strong></a> (to allow testing on your local machine) and your actual app link once it is deployed. In our case it would be <a href="https://react-auth0-example.herokuapp.com/"><strong>https://react-auth0-example.herokuapp.com/</strong></a><strong>. </strong>Save your settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*N6Q-61RDzRg_beKylsq-lQ.png" /></figure><p>14. Go to the <strong>Connections</strong> tab, and enable the connection <strong>react-auth0</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*kZ0P09XTc1LDz9OnVpEiDQ.png" /></figure><p>14. Go to step 10 of the <strong>Heroku setup</strong> to complete the final few steps.</p><p>Take a deep breathe, rest and when you are ready we are midway through our journey.</p><p>Next we do some React code ! Click <a href="https://medium.com/@iankhorbc.thecoder/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-2-or-3-react-7de3818862ce#.q64v2vu56">here for the next part</a> of this publication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18fa929e2cd7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devtechtipstricks/a-simple-login-sign-up-platform-using-react-auth0-with-heroku-deployment-part-1-of-3-setup-18fa929e2cd7">A simple login/sign up platform using React + Auth0 with Heroku deployment (Part 1 of 3 — Setup)</a> was originally published in <a href="https://medium.com/devtechtipstricks">dev &lt;tech&gt; tips &amp; tricks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ten Questions To Ask Yourself When You Debug < … >]]></title>
            <link>https://medium.com/devtechtipstricks/my-personal-top-10-art-of-debugging-problems-in-software-12fb0a01832?source=rss----6c80a8cb2e89---4</link>
            <guid isPermaLink="false">https://medium.com/p/12fb0a01832</guid>
            <category><![CDATA[vba]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Ian Khor]]></dc:creator>
            <pubDate>Wed, 25 Jan 2017 11:58:36 GMT</pubDate>
            <atom:updated>2016-12-13T07:34:46.807Z</atom:updated>
            <content:encoded><![CDATA[<p>I was searching for an article about the ways to debugging software and couldn’t find one for my coding classmates. So I’d thought I’d write one myself, drawing from prior experience in writing software/firmware and designing electronic hardware. Hopefully, this will be a starting point for you to develop debugging skills.</p><p>For newcomers to the world of tech, it’s sometimes hard to know where to begin. Before we can solve problems, we have problems to solve setting up and using the tools that we use to solve the problems! What a paradox! It’s worth it though, because we then have the opportunity to solve interesting world problems, commercial or otherwise.</p><p>The first step to solving the problem is understanding that computers run fast. Really fast. To debug, sometimes we have to be like Neo, with the ability to see things or think as fast as the bullet speeds. This brings us to our question, which i called</p><p><strong>‘Think Bullet Time’</strong>:</p><blockquote><em>What is the computer doing, step by step, to achieve what I see on screen ?</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yHevjCJdLFiMGUUy-mJn0g.jpeg" /><figcaption>Think bullet time. Be The One.</figcaption></figure><p>To answer this question, I need to work out how to see what the computer is doing.</p><p>The following is a short list of questions that have guided me through my debugging experience. While it is not definitive, it hopefully can provide some advice on how to proceed in debugging in a more structured manner.</p><h4><strong>1. Is my setup or configuration correct ?</strong></h4><p>Development tools often come with documentation or datasheets. Spending 5 minutes reading through them and making sure that you have set it up correctly would solve a majority of your problem initially. If things doesn’t work, have you read through the documentation ?</p><h4>2. Did the debug log tell me what the actual problem is ?</h4><p>Don’t be overwhelmed with the many lines of debug logs. They may seem scary but they are actually here to help. Most of the time it actually tells you what and where the actual problem is ! Spend 5 minutes and the trick here is <strong>‘Think Bullet Time’</strong>. What caused that error ? How was the error triggered ?</p><h4>3. Am I in the right folder ?</h4><p>As simple it may seem, with so many things going on in development, are you in your working folder?</p><h4>4. Is it just a syntax or spelling error ?</h4><p>Sometimes its just as simple as a syntax error, you may have accidentally omitted a bracket or closing brace. Sometimes it could be just a spelling error. For example for the HTML DOM property — textContent — can be mispelt as — textContext — . See the error ? When we are reading through code, they make perfect sense because they are spelt correctly !</p><h4>5. Have I passed or received the right datatype ?</h4><p>When you pass elements/data around in your program, are you receiving and passing what you have expected ? For instance, you are trying to fit a spherical ball into a square-shaped hole. In software jargon, your function is expecting an integer but you have passed an array. A sanity check would be helpful sometimes.</p><h4><strong>6. Have I passed the right number of arguments to my function/method ?</strong></h4><p>Similar to Question 5, you might be passing the incorrect number of arguments around.</p><h4>7. Is my data computing correctly when I used iterative methods / logic ?</h4><p>You may have a collection of items (i.e. array) and you perform iterative methods on them such as for, while , do loops. Let’s do a Neo. <strong>‘Think Bullet Time’</strong>, try and display on screen or your debug console whether are you performing the logic right for each item one step at a time.</p><h4>8. Have I tried injecting definitive code/data intentionally and see what I would expect on screen ?</h4><p>You have added a heap of code but still you don’t see the output you want. That could be frustrating. So the question is, is your code actually executing ? You may have written conditional (ie: if or switch) statements but are they actually being executed ? Injecting simple code like printing a simple “Hello world” in your conditional statement may help you see the flow of your program execution.</p><h4>9. Have I tried commenting off code to isolate the problem ?</h4><p>Sometimes you add a new function and something breaks. Have you tried commenting off code to see which line is causing the problem. A line by line approach in commenting off code may be feasible but it is not the most effective way. But that may be a path to follow if you have ran out of ideas on what the problem is.</p><h4><strong>10. I still have no idea what is wrong, have I used a pen and paper to draw out what is happening ?</strong></h4><p>As humans we are highly visual animals. At least I know I am. Sometimes when I really have no idea what is hapenning, I would step back, take a deep breathe and try to get a birds eye view of what is happening. A little old school but sometimes with just a pen and paper, we free up our minds from all the technical bits and just use what comes naturally to us — A pen and paper — and see visually how things work. Just draw it out. That’s why engineers have top level or system diagrams !</p><p>So hopefully the above would help you in some way getting closer to solving your problem. And lastly <strong>‘Think Bullet Time’</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aIpu6x33FEUtI9NNhcdvmA.jpeg" /><figcaption>‘Think Bullet Time’ and you may be The One.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12fb0a01832" width="1" height="1" alt=""><hr><p><a href="https://medium.com/devtechtipstricks/my-personal-top-10-art-of-debugging-problems-in-software-12fb0a01832">Ten Questions To Ask Yourself When You Debug &lt; … &gt;</a> was originally published in <a href="https://medium.com/devtechtipstricks">dev &lt;tech&gt; tips &amp; tricks</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>