appirio-tech/accounts-app

Name: accounts-app

Owner: Topcoder

Description: accounts.topcoder.com

Created: 2016-03-03 06:00:46.0

Updated: 2018-03-18 22:41:57.0

Pushed: 2018-03-18 22:41:55.0

Homepage: null

Size: 3732

Language: CSS

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Goal

Standardize auth logic across all Topcoder frontend apps.

This repo contains several pieces:

  1. The accounts app itself, as deployed at accounts.topcoder.com
  2. The connector mini-app, as deployed at accounts.topcoder.com/connector.html
  3. An npm module exposing:
  4. The connector-wrapper module that provides
  5. A library of shared auth functionality (token handling, etc.)

Using Connector in your app

Install
m install --save tc-accounts
Configure

The connector exports a configureConnector method that must be invoked before any of the other methods, which likely means the entry of your app, or the entry of your auth logic. This will create and attach the connector iFrame to the DOM in your app.

rt { configureConnector } from 'tc-accounts'

igureConnector({
nnectorUrl: 'https://accounts.topcoder.com/connector.html',
ameId: 'tc-accounts-iframe'

Use
rt { getFreshToken } from 'tc-accounts'

reshToken().then( token => {
nsole.log(token)

API Reference
t config = function($httpProvider, jwtInterceptorProvider) {
nction jwtInterceptor() {
return getFreshToken()


tInterceptorProvider.tokenGetter = jwtInterceptor

ttpProvider.interceptors.push('jwtInterceptor')

Contributing

Getting Started

If you only need to work on the app itself, getting up and running is super simple.

m install
m run dev
Testing integration locally

If you need to test your integration locally, you'll need a few more steps. The iframe technique we are using here does not play well with webpack-dev-server, and we need to serve two apps from the same subdomain (port, in this case).

m install
m run build:dev
m run build:connector

You'll need to rerun the build:dev and build:connector commands manually to see your updates.

© 2017 Topcoder. All Rights Reserved


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.