JavaScript
Dimos Koromilas, Jan 16

How to Test Your JavaScript with Selenium WebDriver and Mocha

Learn to write functional JavaScript tests with Selenium WebDriver 3, Mocha and Node.js.
Web
Christopher Pitt, Jan 16

Build George Costanza's Bathroom Finder using WRLD

This fun tutorial takes the George Costanza's brilliant idea and makes it a reality. We build a bathroom finder app using WRLD's 3D mapping platform.
5 COMMENTs
JavaScript
Camilo Reyes, Jan 15

Debugging JavaScript with the Node Debugger

Camilo Reyes takes a look at the little known Node Debugger and shows how to use it to hunt down bugs in both server and client-side JavaScript.
6 COMMENTs
JavaScript
Jani Hartikainen, Jan 12

Unit Test Your JavaScript Using Mocha and Chai

Jani Hartikainen gets you started with unit testing your JavaScript — an important, but often overlooked part of development — using Mocha and Chai.
33 COMMENTs
JavaScript
M. David Green, Jan 10

An Introduction to Functional JavaScript

M. David Green demonstrates how you can start thinking functionally in JavaScript, by refactoring some all-too-common imperative code to a functional style.
50 COMMENTs
JavaScript
Michael Wanyoike, Jan 08

A Beginner’s Guide to npm — the Node Package Manager

npm is a command-line tool for interacting with a huge repository of Node.js projects. Peter Dierx shows how you can start using it in your projects today.
12 COMMENTs
JavaScript
Craig Buckler, Dec 21

How to Track Ecommerce Transactions with Google Analytics

Craig Buckler shows how, with a small amount of code, you can use Google Analytics to track online shop transactions and every product purchased.
Web
Christopher Pitt, Dec 21

The following takes place with an API called WRLD...

Set in the World of 24 with Jack Bauer, this tutorial takes you on an epic, but easy to follow journey, to build a dynamic 3D map using WRLD.
11 COMMENTs
JavaScript
Craig Buckler, Dec 17

How to Track JavaScript and Ajax Events with Google Analytics

Craig Buckler shows how to use Google Analytics to track not just page views but also events such as Ajax updates, file downloads and social interactions.
Offers
SitePoint Team, Dec 13

Get the Ultimate Web Development Beginner Bundle for Only $29

Good deal alert! For 48 hours only SitePoint is offering their ultimate web development beginner bundle for just $29. That's a saving of $435
JavaScript
Tony Spiro, Dec 05

How to Build a Simple Blog Using React and GraphQL

This tutorial shows you how to easily create a simple blog that is both fast and light-weight, using React, GraphQL and Cosmic JS.
JavaScript
Ivan Čurić, Nov 27

JavaScript Performance Optimization Tips: An Overview

Ivan digs into JavaScript performance, from environments, response times, context, parsing, compiling and executing, to bundle sizes and shipping less code.
JavaScript
Ahmed Bouchefra, Nov 24

Progressive Web Apps: A Crash Course

Ahmed explains PWAs by showing how to build a PWA from scratch with ES6 and React, optimizing it step by step with Lighthouse for UX and performance.
JavaScript
Karen Teboulle, Nov 15

Essential Skills for Landing a Test Automation Job in 2018

Following our last research, we examined top job searching websites around the world to determine in-demand automation skills and technologies for 2018.
JavaScript
Dan Greenberg, Nov 10

7 Open-Source Test Automation Frameworks

Here are the pros and cons of 7 different open-source test automation frameworks.
JavaScript
Todd Motto, Nov 09

Top 12 Productivity Tips for WebStorm and Angular – Part 2

Todd Motto walks you through his top productivity tips for Angular development with WebStorm.
JavaScript
Michiel Mulders, Nov 01

How to Deploy Node Applications: Heroku vs Now.sh

Michiel Mulders compares Heroku and Now.sh, showing how to deploy Node apps to each service and looking at additional features like monitoring and logging.
JavaScript
Lee Brandt, Oct 30

Build a React App with User Authentication in 15 Minutes

This article originally appeared on the OKTA blog. Thank you for supporting the partners who make SitePoint possible.

React has quickly become one of the most favored front-end web frameworks, and is second only to plain old HTML5, according to JAXenter. So it’s no surprise that developers are learning it, and employers are asking for it.

In this tutorial, you’ll start with a very simple React app with a couple of pages and some routing built in, and add authentication using Okta’s Sign-In Widget. The Sign-In Widget is an embeddable Javascript widget that allows developers to use Okta’s secure, scalable architecture with a minimum of effort from within React applications. Let’s get started!

Get the Simple React Seed Project

Start by cloning the simple React seed project.

git clone https://github.com/leebrandt/simple-react-seed.git okta-react-widget-sample
cd okta-react-widget-sample

Add the Okta Sign-In Widget

Install the Okta Sign-In Widget using npm.

npm install @okta/okta-signin-widget@2.3.0 --save

This will add the Okta Sign-In Widget code to your node_modules folder. We’ll be using version 2.3.0 of the Sign-In Widget.

Okta in node_modules

Then add the styles for the widget in your index.html file from the Okta CDN. Add these lines inside the <head> tag:

    <link
     href="https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/2.3.0/css/okta-sign-in.min.css"
      type="text/css"
      rel="stylesheet"/>

    <!-- Theme file: Customize or replace this file if you want to override our default styles -->
    <link
      href="https://ok1static.oktacdn.com/assets/js/sdk/okta-signin-widget/2.3.0/css/okta-theme.css"
      type="text/css"
      rel="stylesheet"/>

The LoginPage Component

First, create a folder called auth in the ./src/components folder, then create a file called LoginPage.js where the LoginPage component will go.

Start with the most basic of components:

import React from 'react';

export default class LoginPage extends React.Component{
  render(){
    return(
      <div>Login Page</div>
    );
  }
}

This little component doesn't do much but at least you now have a handle to add the LoginPage to your routing. So in your ./src/app.js file, you'll import the component at the top:

import LoginPage from './components/auth/LoginPage';

and then add the route inside the main route (the one with the path of "/")

<Route path="/login" component={LoginPage}/>

Add the OpenID Connect Application in Okta

In order to use Okta as your OpenID Connect provider for authentication, you’ll need to set up an application in the Okta developer console.

If you don't have an Okta developer account, go create one! Once you're logged in, click on Applications in the top navbar, then click Add Application. Select SPA as the platform and click Next. Change the redirect URI to http://localhost:3000, and click Done. The application will be created with the following settings:

OIDC Application Settings

Now that you have an application created in Okta, you can set up the widget to talk to your new app!

Add the Widget to Your Component

import React from 'react';
import OktaSignIn from '@okta/okta-signin-widget';

export default class LoginPage extends React.Component{
  constructor(){
    super();
    this.widget = new OktaSignIn({
      baseUrl: 'https://{oktaOrgUrl}',
      clientId: '{clientId}',
      redirectUri: 'http://localhost:3000',
      authParams: {
        responseType: 'id_token'
      }
    });
  }

  render(){
    return(
      <div>Login Page</div>
    );
  }
}

Copy the Client ID generated from your application's settings page and paste it over {clientId}. Make sure you also replace {oktaOrgUrl} with your Okta organization URL, which you can find by going back to the main Dashboard page in the developer console. Usually it will look like: https://dev-12345.oktapreview.com.

Thus far you've imported the OktaSignIn function from the Okta Sign-In Widget npm module you installed earlier. Next, in the constructor of the component, you initialized an instance of OktaSignIn with the configuration for the application. This way, the application code will be able to talk to Okta and Okta will recognize that this is the app you just created.

Show The Login Widget

Next, you’ll create the code to actually render the Sign-In Widget to the page! You'll need to change your render method to create an HTML element you can render the widget into. Make sure to get a reference to the element that will be rendered. Then, add a componentDidMount function to make sure you don't try to render the widget before the HTML element is on the page.

JavaScript
Kaloyan Kolev, Oct 27

Quickly Create Simple yet Powerful Angular Forms

Forms are an essential part of most web applications. Kaloyan Kolev shows how to create template-driven and reactive Angular forms along with validation.
JavaScript
Jurgen Van de Moere, Oct 19

Top 12 Productivity Tips for WebStorm and Angular - Part 1

Jurgen Van de Moere shows you how to complete your Angular projects quickly with JetBrains' WebStorm IDE.
JavaScript
Adam Roberts, Oct 18

Learning Angular: Everything You Need to Get Started

A handy collection of resources that provides you with everything you need to know to start building Angular apps.
JavaScript
Graham Cox, Oct 16

Ember.js: The Perfect Framework for Web Applications

Ember.js lets you scaffold and build complex frontend web applications quickly. Graham Cox explores this popular, batteries-included JavaScript framework.
JavaScript
Matt Raible, Oct 11

Getting Started with Angular and User Authentication

An easy step-by-step guide to show you how to get started building with Angular and to add user authentication to your app using Okta's Sign-In Widget.
JavaScript
M. David Green, Oct 10

How to Set Up Airbrake Error Monitoring for Your JavaScript App

Error monitoring can save you when things start to fall apart. Learn how to get Airbrake working with your JavaScript web apps.