Skip to content

Commit 7570fb0

Browse files
author
sachin-maheshwari
authored
Merge pull request #838 from topcoder-platform/feature/Auth0-RS256-Token
new login flow changes
2 parents 32a8e7e + 9e69bcd commit 7570fb0

File tree

7 files changed

+10
-11
lines changed

7 files changed

+10
-11
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ workflows:
7171
filters:
7272
branches:
7373
only:
74-
- develop
74+
- "feature/Auth0-RS256-Token"
7575

7676
# Production builds are exectuted only on tagged commits to the
7777
# master branch.

config/constants/development.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const DOMAIN = 'topcoder-dev.com'
22
const DEV_API_HOSTNAME = `https://api.${DOMAIN}`
33

44
module.exports = {
5-
ACCOUNTS_APP_CONNECTOR_URL: `https://accounts.${DOMAIN}/connector.html`,
6-
ACCOUNTS_APP_LOGIN_URL: `https://accounts.${DOMAIN}/member`,
5+
ACCOUNTS_APP_CONNECTOR_URL: `https://accounts-auth0.${DOMAIN}`,
6+
ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`,
77
COMMUNITY_APP_URL: `https://www.${DOMAIN}`,
88
MEMBER_API_URL: `${DEV_API_HOSTNAME}/v4/members`,
99
MEMBER_API_V3_URL: `${DEV_API_HOSTNAME}/v3/members`,

config/constants/production.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ const DOMAIN = 'topcoder.com'
22
const PROD_API_HOSTNAME = `https://api.${DOMAIN}`
33

44
module.exports = {
5-
ACCOUNTS_APP_CONNECTOR_URL: process.env.ACCOUNTS_APP_CONNECTOR_URL || `https://accounts.${DOMAIN}/connector.html`,
6-
ACCOUNTS_APP_LOGIN_URL: `https://accounts.${DOMAIN}/member`,
5+
ACCOUNTS_APP_CONNECTOR_URL: process.env.ACCOUNTS_APP_CONNECTOR_URL || `https://accounts-auth0.${DOMAIN}`,
6+
ACCOUNTS_APP_LOGIN_URL: `https://accounts-auth0.${DOMAIN}`,
77
COMMUNITY_APP_URL: `https://www.${DOMAIN}`,
88
MEMBER_API_URL: `${PROD_API_HOSTNAME}/v4/members`,
99
MEMBER_API_V3_URL: `${PROD_API_HOSTNAME}/v3/members`,

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
"sass-loader": "7.1.0",
9090
"simplemde": "^1.11.2",
9191
"style-loader": "0.23.0",
92-
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git",
92+
"tc-auth-lib": "topcoder-platform/tc-auth-lib#1.0.1",
9393
"terser": "^3.16.1",
9494
"terser-webpack-plugin": "1.1.0",
9595
"topcoder-healthcheck-dropin": "^1.0.3",

src/actions/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { configureConnector, decodeToken } from 'tc-accounts'
1+
import { configureConnector, decodeToken } from 'tc-auth-lib'
22
import { fetchProfile } from '../services/user'
33
import {
44
LOAD_USER_SUCCESS,

src/routes.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44
import React from 'react'
55
import PropTypes from 'prop-types'
66
import { Redirect, Route, Switch, withRouter } from 'react-router-dom'
7-
import jwtDecode from 'jwt-decode'
87
import _ from 'lodash'
98
import renderApp from './components/App'
109
import TopBarContainer from './containers/TopbarContainer'
1110
import Sidebar from './containers/Sidebar'
1211
import ChallengeList from './containers/Challenges'
1312
import ChallengeEditor from './containers/ChallengeEditor'
14-
import { getFreshToken } from 'tc-accounts'
13+
import { getFreshToken, decodeToken } from 'tc-auth-lib'
1514
import { saveToken } from './actions/auth'
1615
import { loadChallengeDetails } from './actions/challenges'
1716
import { connect } from 'react-redux'
@@ -78,7 +77,7 @@ class Routes extends React.Component {
7877
return null
7978
}
8079

81-
let isAllowed = checkAllowedRoles(_.get(jwtDecode(this.props.token), 'roles'))
80+
let isAllowed = checkAllowedRoles(_.get(decodeToken(this.props.token), 'roles'))
8281

8382
if (!isAllowed) {
8483
let warnMessage = 'You are not authorized to use this application'

src/services/axiosWithAuth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import axios from 'axios'
22
import store from '../config/store'
3-
import { getFreshToken, isTokenExpired } from 'tc-accounts'
3+
import { getFreshToken, isTokenExpired } from 'tc-auth-lib'
44
const { ACCOUNTS_APP_LOGIN_URL } = process.env
55

66
/**

0 commit comments

Comments
 (0)