Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to React 17 and move code to env files #20

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
move oidc settings to env files
workcontrolgit committed Jun 7, 2021
commit a95fa684539d22f8ebf5b37fa334182983252871
4 changes: 3 additions & 1 deletion src/.env
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
REACT_APP_CLIENT_ID = `React.Spa`;
REACT_APP_CLIENT_ID = 'React.Spa'
REACT_APP_RESPONSE_TYPE = 'code'
REACT_APP_CLIENT_SCOPE = 'openid profile email roles app.api.employeeprofile.read'
4 changes: 2 additions & 2 deletions src/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_STS_AUTHORITY = "https://localhost:44310"
REACT_APP_API_ENDPOINT = "https://localhost:44378/api/"
REACT_APP_STS_AUTHORITY = 'https://localhost:44310'
REACT_APP_API_ENDPOINT = 'https://localhost:44378/api/'
4 changes: 2 additions & 2 deletions src/.env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_STS_AUTHORITY = "https://cat-token-identity.azurewebsites.net"
REACT_APP_API_ENDPOINT = "https://cat-netcore-api.azurewebsites.net/api/"
REACT_APP_STS_AUTHORITY = 'https://cat-token-identity.azurewebsites.net'
REACT_APP_API_ENDPOINT = 'https://cat-netcore-api.azurewebsites.net/api/'
2 changes: 0 additions & 2 deletions src/src/helpers/Constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
export class Constants {
//public static stsAuthority = 'https://localhost:44310';
public static stsAuthority = 'https://cat-token-identity.azurewebsites.net';
public static clientId = 'React.Spa';
public static clientScope = 'openid profile email roles app.api.employeeprofile.read';

6 changes: 3 additions & 3 deletions src/src/services/AuthService.ts
Original file line number Diff line number Diff line change
@@ -8,12 +8,12 @@ export class AuthService {
constructor() {
const settings = {
authority: process.env.REACT_APP_STS_AUTHORITY,
client_id: 'React.Spa',
client_id: process.env.REACT_APP_CLIENT_ID,
redirect_uri: window.location.origin + '/signin-callback.html',
silent_redirect_uri: window.location.origin + '/silent-renew.html',
post_logout_redirect_uri: window.location.origin,
response_type: 'code',
scope: Constants.clientScope
response_type: process.env.REACT_APP_RESPONSE_TYPE,
scope: process.env.REACT_APP_CLIENT_SCOPE
};

this.userManager = new UserManager(settings);