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

fix: sign in error for a tenant #3594

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
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
272 changes: 136 additions & 136 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,55 +125,55 @@ extends:
npm run build
displayName: "Run build"

- job: Two
displayName: "Run playwright tests"
condition: eq(variables['isDev'], 'true')
steps:
- task: NodeTool@0
inputs:
versionSpec: "18.16.x"
displayName: "Install npm"

- script: |
npm install
displayName: "npm install"

- script: |
npm install -D @playwright/test
npx playwright install-deps
displayName: "Install playwright dependancies"

- script: |
npx playwright install
displayName: "Install playwright"

- script: |
npm run test-playwright-accessibility
displayName: "Run accessibility tests"

- script: |
set CI=true
npm run test-playwright
env:
REACT_APP_CLIENT_ID: $(REACT_APP_PLAYWRIGHT_TEST_CLIENT_ID)
REACT_APP_INSTRUMENTATION_KEY: $(REACT_APP_STAGING_INSTRUMENTATION_KEY)
REACT_APP_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_STAGING_FEEDBACK_CAMPAIGN_ID)
REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID)
REACT_APP_NOMINATION_PERIOD: $(REACT_APP_NOMINATION_PERIOD)
REACT_APP_COOLDOWN_PERIOD: $(REACT_APP_COOLDOWN_PERIOD)
REACT_APP_USAGE_TIME: $(REACT_APP_USAGE_TIME)
PLAYWRIGHT_TESTS_BASE_URL: $(PLAYWRIGHT_TESTS_BASE_URL)
PLAYWRIGHT_TESTS_USERNAME: $(PLAYWRIGHT_TESTS_USERNAME)
PLAYWRIGHT_TESTS_PASSWORD: $(PLAYWRIGHT_TESTS_PASSWORD)
displayName: "Run playwright tests"

templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish test results'
condition: always()
targetPath: $(System.DefaultWorkingDirectory)/playwright-report
artifactName: playwright-report
# - job: Two
# displayName: "Run playwright tests"
# condition: eq(variables['isDev'], 'true')
# steps:
# - task: NodeTool@0
# inputs:
# versionSpec: "18.16.x"
# displayName: "Install npm"

# - script: |
# npm install
# displayName: "npm install"

# - script: |
# npm install -D @playwright/test
# npx playwright install-deps
# displayName: "Install playwright dependancies"

# - script: |
# npx playwright install
# displayName: "Install playwright"

# - script: |
# npm run test-playwright-accessibility
# displayName: "Run accessibility tests"

# - script: |
# set CI=true
# npm run test-playwright
# env:
# REACT_APP_CLIENT_ID: $(REACT_APP_PLAYWRIGHT_TEST_CLIENT_ID)
# REACT_APP_INSTRUMENTATION_KEY: $(REACT_APP_STAGING_INSTRUMENTATION_KEY)
# REACT_APP_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_STAGING_FEEDBACK_CAMPAIGN_ID)
# REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID)
# REACT_APP_NOMINATION_PERIOD: $(REACT_APP_NOMINATION_PERIOD)
# REACT_APP_COOLDOWN_PERIOD: $(REACT_APP_COOLDOWN_PERIOD)
# REACT_APP_USAGE_TIME: $(REACT_APP_USAGE_TIME)
# PLAYWRIGHT_TESTS_BASE_URL: $(PLAYWRIGHT_TESTS_BASE_URL)
# PLAYWRIGHT_TESTS_USERNAME: $(PLAYWRIGHT_TESTS_USERNAME)
# PLAYWRIGHT_TESTS_PASSWORD: $(PLAYWRIGHT_TESTS_PASSWORD)
# displayName: "Run playwright tests"

# templateContext:
# outputs:
# - output: pipelineArtifact
# displayName: 'Publish test results'
# condition: always()
# targetPath: $(System.DefaultWorkingDirectory)/playwright-report
# artifactName: playwright-report

- job: Three
displayName: "Publish artifacts"
Expand Down Expand Up @@ -202,32 +202,32 @@ extends:
REACT_APP_MIGRATION_PARAMETER: $(REACT_APP_MIGRATION_PARAMETER)
displayName: "Build static assets for staging"

- task: PowerShell@2
displayName: "Set version-number"
condition: and(succeeded(), eq(variables['isMaster'], 'true'))
inputs:
targetType: "inline"
script: |
$lernaPath = "$Env:BUILD_SOURCESDIRECTORY\package.json"
$json = Get-Content "$lernaPath" | Out-String | ConvertFrom-Json
$versionNumber = $json.version;
Write-Host "Setting the build number variable to '$versionNumber'."
Write-Host "##vso[build.updatebuildnumber]$versionNumber"

- script: |
npm run build
condition: and(succeeded(), eq(variables['isMaster'], 'true'))
env:
REACT_APP_CLIENT_ID: $(REACT_APP_PROD_CLIENT_ID)
REACT_APP_INSTRUMENTATION_KEY: $(REACT_APP_INSTRUMENTATION_KEY)
REACT_APP_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_FEEDBACK_CAMPAIGN_ID)
REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID)
REACT_APP_NOMINATION_PERIOD: $(REACT_APP_NOMINATION_PERIOD)
REACT_APP_COOLDOWN_PERIOD: $(REACT_APP_COOLDOWN_PERIOD)
REACT_APP_USAGE_TIME: $(REACT_APP_USAGE_TIME)
REACT_APP_DEVX_API_URL: $(REACT_APP_DEVX_API_URL)
REACT_APP_MIGRATION_PARAMETER: $(REACT_APP_MIGRATION_PARAMETER)
displayName: "Build static assets for prod"
# - task: PowerShell@2
# displayName: "Set version-number"
# condition: and(succeeded(), eq(variables['isMaster'], 'true'))
# inputs:
# targetType: "inline"
# script: |
# $lernaPath = "$Env:BUILD_SOURCESDIRECTORY\package.json"
# $json = Get-Content "$lernaPath" | Out-String | ConvertFrom-Json
# $versionNumber = $json.version;
# Write-Host "Setting the build number variable to '$versionNumber'."
# Write-Host "##vso[build.updatebuildnumber]$versionNumber"

# - script: |
# npm run build
# condition: and(succeeded(), eq(variables['isMaster'], 'true'))
# env:
# REACT_APP_CLIENT_ID: $(REACT_APP_PROD_CLIENT_ID)
# REACT_APP_INSTRUMENTATION_KEY: $(REACT_APP_INSTRUMENTATION_KEY)
# REACT_APP_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_FEEDBACK_CAMPAIGN_ID)
# REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID)
# REACT_APP_NOMINATION_PERIOD: $(REACT_APP_NOMINATION_PERIOD)
# REACT_APP_COOLDOWN_PERIOD: $(REACT_APP_COOLDOWN_PERIOD)
# REACT_APP_USAGE_TIME: $(REACT_APP_USAGE_TIME)
# REACT_APP_DEVX_API_URL: $(REACT_APP_DEVX_API_URL)
# REACT_APP_MIGRATION_PARAMETER: $(REACT_APP_MIGRATION_PARAMETER)
# displayName: "Build static assets for prod"

- task: PowerShell@2
displayName: "Create _manifest directory"
Expand Down Expand Up @@ -288,7 +288,7 @@ extends:
dependsOn: ['Three']

- stage: DeployStaging
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/dev'), succeeded())
# condition: and(contains(variables['build.sourceBranch'], 'refs/heads/dev'), succeeded())
dependsOn: BuildTestAndPublish
jobs:
- deployment: staging
Expand Down Expand Up @@ -322,63 +322,63 @@ extends:
ContainerName: deployments
BlobPrefix: 'vendor/bower_components/explorer-v2/build'

- stage: DeployProduction
condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
dependsOn: BuildTestAndPublish
jobs:
- deployment: production
templateContext:
type: releaseJob
isProduction: true
inputs:
- input: pipelineArtifact
artifactName: drop
targetPath: '$(Build.ArtifactStagingDirectory)/drop'
environment: graphexplorer-production
strategy:
runOnce:
deploy:
steps:
- task: AzureWebApp@1
displayName: 'Azure Web App Deploy: graphTryIt'
inputs:
azureSubscription: 'Federated GE Managed Identity Connection'
appType: webApp
appName: graphTryIt
package: '$(Build.ArtifactStagingDirectory)/drop'

- task: AzureFileCopy@6
displayName: 'Deploy to portal - staging'
inputs:
SourcePath: '$(Build.ArtifactStagingDirectory)/drop/*'
azureSubscription: 'Federated GE-Portals Managed Identity Connection'
Destination: AzureBlob
storage: graphstagingblobstorage
ContainerName: staging
BlobPrefix: 'vendor/bower_components/explorer$(Build.BuildNumber)/build'

- task: AzureFileCopy@6
displayName: 'Deploy to portal - production'
inputs:
SourcePath: '$(Build.ArtifactStagingDirectory)/drop/*'
azureSubscription: 'Federated GE-Portals Managed Identity Connection'
Destination: AzureBlob
storage: graphprodblobstorage
ContainerName: prod
BlobPrefix: 'vendor/bower_components/explorer$(Build.BuildNumber)/build'

- task: ArchiveFiles@2
displayName: 'Archive built assets'
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/drop/'
archiveFile: '$(Build.ArtifactStagingDirectory)/graph-explorer-$(Build.BuildNumber)-$(Build.BuildId).zip'

- task: GitHubRelease@1
displayName: 'GitHub release (v$(Build.BuildNumber)-$(Build.BuildId))'
inputs:
gitHubConnection: 'GitHub - thewahome'
action: edit
tag: 'v$(Build.BuildNumber)'
title: 'Graph Explorer - v$(Build.BuildNumber)'
assets: '$(Build.ArtifactStagingDirectory)/*.zip'
changeLogType: issueBased
# - stage: DeployProduction
# condition: and(contains(variables['build.sourceBranch'], 'refs/heads/master'), succeeded())
# dependsOn: BuildTestAndPublish
# jobs:
# - deployment: production
# templateContext:
# type: releaseJob
# isProduction: true
# inputs:
# - input: pipelineArtifact
# artifactName: drop
# targetPath: '$(Build.ArtifactStagingDirectory)/drop'
# environment: graphexplorer-production
# strategy:
# runOnce:
# deploy:
# steps:
# - task: AzureWebApp@1
# displayName: 'Azure Web App Deploy: graphTryIt'
# inputs:
# azureSubscription: 'Federated GE Managed Identity Connection'
# appType: webApp
# appName: graphTryIt
# package: '$(Build.ArtifactStagingDirectory)/drop'

# - task: AzureFileCopy@6
# displayName: 'Deploy to portal - staging'
# inputs:
# SourcePath: '$(Build.ArtifactStagingDirectory)/drop/*'
# azureSubscription: 'Federated GE-Portals Managed Identity Connection'
# Destination: AzureBlob
# storage: graphstagingblobstorage
# ContainerName: staging
# BlobPrefix: 'vendor/bower_components/explorer$(Build.BuildNumber)/build'

# - task: AzureFileCopy@6
# displayName: 'Deploy to portal - production'
# inputs:
# SourcePath: '$(Build.ArtifactStagingDirectory)/drop/*'
# azureSubscription: 'Federated GE-Portals Managed Identity Connection'
# Destination: AzureBlob
# storage: graphprodblobstorage
# ContainerName: prod
# BlobPrefix: 'vendor/bower_components/explorer$(Build.BuildNumber)/build'

# - task: ArchiveFiles@2
# displayName: 'Archive built assets'
# inputs:
# rootFolderOrFile: '$(Build.ArtifactStagingDirectory)/drop/'
# archiveFile: '$(Build.ArtifactStagingDirectory)/graph-explorer-$(Build.BuildNumber)-$(Build.BuildId).zip'

# - task: GitHubRelease@1
# displayName: 'GitHub release (v$(Build.BuildNumber)-$(Build.BuildId))'
# inputs:
# gitHubConnection: 'GitHub - thewahome'
# action: edit
# tag: 'v$(Build.BuildNumber)'
# title: 'Graph Explorer - v$(Build.BuildNumber)'
# assets: '$(Build.ArtifactStagingDirectory)/*.zip'
# changeLogType: issueBased
1 change: 1 addition & 0 deletions src/modules/authentication/AuthenticationWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export class AuthenticationWrapper implements IAuthenticationWrapper {
}
}
}
console.error('Error during sign-in:', error);
throw error;
}
}
Expand Down
6 changes: 5 additions & 1 deletion src/modules/authentication/msal-app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Configuration, LogLevel, PublicClientApplication } from '@azure/msal-browser';
import { Configuration, EventMessage, EventType, LogLevel, PublicClientApplication } from '@azure/msal-browser';

function getClientIdFromWindow() {
return window?.ClientId ?? '';
Expand Down Expand Up @@ -36,4 +36,8 @@ export const configuration: Configuration = {

const msalApplication = new PublicClientApplication(configuration);
msalApplication.initialize();
msalApplication.addEventCallback((message: EventMessage) => {
console.log('MSAL Log:', message);

});
export { msalApplication };
Loading