Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ workflows:
filters:
branches:
only:
- develop
- "feature/Auth0-RS256-Token"

# Production builds are exectuted only on tagged commits to the
# master branch.
- "build-prod":
context : org-global
filters:
branches:
only: master
only: master
4 changes: 2 additions & 2 deletions config/constants/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const DOMAIN = 'topcoder-dev.com'
const DEV_API_HOSTNAME = `https://api.${DOMAIN}`

module.exports = {
ACCOUNTS_APP_CONNECTOR_URL: `https://accounts.${DOMAIN}/connector.html`,
ACCOUNTS_APP_LOGIN_URL: `https://accounts.${DOMAIN}/member`,
ACCOUNTS_APP_CONNECTOR_URL: `https://accounts-auth0.${DOMAIN}`,
ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`,
COMMUNITY_APP_URL: `https://www.${DOMAIN}`,
MEMBER_API_URL: `${DEV_API_HOSTNAME}/v4/members`,
MEMBER_API_V3_URL: `${DEV_API_HOSTNAME}/v3/members`,
Expand Down
4 changes: 2 additions & 2 deletions config/constants/production.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ const DOMAIN = 'topcoder.com'
const PROD_API_HOSTNAME = `https://api.${DOMAIN}`

module.exports = {
ACCOUNTS_APP_CONNECTOR_URL: process.env.ACCOUNTS_APP_CONNECTOR_URL || `https://accounts.${DOMAIN}/connector.html`,
ACCOUNTS_APP_LOGIN_URL: `https://accounts.${DOMAIN}/member`,
ACCOUNTS_APP_CONNECTOR_URL: process.env.ACCOUNTS_APP_CONNECTOR_URL || `https://accounts-auth0.${DOMAIN}`,
ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`,
COMMUNITY_APP_URL: `https://www.${DOMAIN}`,
MEMBER_API_URL: `${PROD_API_HOSTNAME}/v4/members`,
MEMBER_API_V3_URL: `${PROD_API_HOSTNAME}/v3/members`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"sass-loader": "7.1.0",
"simplemde": "^1.11.2",
"style-loader": "0.23.0",
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git",
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.1",
"terser": "^3.16.1",
"terser-webpack-plugin": "1.1.0",
"topcoder-healthcheck-dropin": "^1.0.3",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { configureConnector, decodeToken } from 'tc-accounts'
import { configureConnector, decodeToken } from 'tc-auth-lib'
import { fetchProfile } from '../services/user'
import {
LOAD_USER_SUCCESS,
Expand Down
5 changes: 2 additions & 3 deletions src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
import React from 'react'
import PropTypes from 'prop-types'
import { Redirect, Route, Switch, withRouter } from 'react-router-dom'
import jwtDecode from 'jwt-decode'
import _ from 'lodash'
import renderApp from './components/App'
import TopBarContainer from './containers/TopbarContainer'
import Sidebar from './containers/Sidebar'
import ChallengeList from './containers/Challenges'
import ChallengeEditor from './containers/ChallengeEditor'
import { getFreshToken } from 'tc-accounts'
import { getFreshToken, decodeToken } from 'tc-auth-lib'
import { saveToken } from './actions/auth'
import { loadChallengeDetails } from './actions/challenges'
import { connect } from 'react-redux'
Expand Down Expand Up @@ -78,7 +77,7 @@ class Routes extends React.Component {
return null
}

let isAllowed = checkAllowedRoles(_.get(jwtDecode(this.props.token), 'roles'))
let isAllowed = checkAllowedRoles(_.get(decodeToken(this.props.token), 'roles'))

if (!isAllowed) {
let warnMessage = 'You are not authorized to use this application'
Expand Down
2 changes: 1 addition & 1 deletion src/services/axiosWithAuth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import axios from 'axios'
import store from '../config/store'
import { getFreshToken, isTokenExpired } from 'tc-accounts'
import { getFreshToken, isTokenExpired } from 'tc-auth-lib'
const { ACCOUNTS_APP_LOGIN_URL } = process.env

/**
Expand Down