Skip to content

Commit b48e27c

Browse files
SSO papercuts (more logs & make downloading them easier) (#1930)
* make sso logs download button look like a button * improve SSO auth logging
1 parent 41a154b commit b48e27c

File tree

3 files changed

+38
-6
lines changed

3 files changed

+38
-6
lines changed

src/browser/modules/Stream/Auth/ConnectForm.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,15 @@ export default function ConnectForm(props: ConnectFormProps): JSX.Element {
392392
{props.authenticationMethod === SSO &&
393393
!SSOLoading &&
394394
(SSOError || SSORedirectError) && (
395-
<StyledSSOError>
396-
<StyledCypherErrorMessage>ERROR</StyledCypherErrorMessage>
397-
<div>{SSOError || SSORedirectError}</div>
395+
<>
396+
<StyledSSOError>
397+
<StyledCypherErrorMessage>ERROR</StyledCypherErrorMessage>
398+
<div>{SSOError || SSORedirectError}</div>
399+
</StyledSSOError>
398400
<StyledSSOLogDownload onClick={downloadAuthLogs}>
399-
Download logs
401+
Download browser SSO logs
400402
</StyledSSOLogDownload>
401-
</StyledSSOError>
403+
</>
402404
)}
403405

404406
{props.connecting

src/browser/modules/Stream/Auth/styled.tsx

+20-1
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,33 @@ export const StyledDbsRow = styled.li``
152152
export const StyledFormContainer = styled.div`
153153
display: flex;
154154
`
155-
export const StyledSSOLogDownload = styled.a`
155+
export const StyledSSOLogDownload = styled.button`
156+
color: ${props => props.theme.primaryButtonText};
157+
background-color: ${props => props.theme.primary};
158+
border: 1px solid ${props => props.theme.primary};
159+
font-family: ${props => props.theme.primaryFontFamily};
160+
padding: 6px 18px;
161+
font-weight: 600;
162+
font-size: 14px;
163+
text-align: center;
164+
vertical-align: middle;
156165
cursor: pointer;
166+
border-radius: 4px;
167+
line-height: 20px;
168+
169+
&:hover {
170+
background-color: ${props => props.theme.primary50};
171+
color: ${props => props.theme.secondaryButtonTextHover};
172+
border: 1px solid ${props => props.theme.primary50};
173+
}
157174
`
175+
158176
export const StyledSSOButtonContainer = styled.div`
159177
margin-bottom: 12px;
160178
`
161179
export const StyledSSOError = styled.div`
162180
margin-top: 30px;
163181
padding: 3px;
164182
white-space: pre-line;
183+
display: flex;
165184
`

src/shared/modules/connections/connectionsDuck.ts

+11
Original file line numberDiff line numberDiff line change
@@ -561,6 +561,11 @@ export const startupConnectEpic = (action$: any, store: any) => {
561561
resolve({ type: STARTUP_CONNECTION_SUCCESS })
562562
})
563563
.catch(() => {
564+
if (discovered.attemptSSOLogin) {
565+
authLog(
566+
'client side SSO flow completed but Neo4j Browser failed to connect to neo4j. Server side logs (security.log or debug.log) may contain more information.'
567+
)
568+
}
564569
store.dispatch(setActiveConnection(null))
565570
store.dispatch(
566571
discovery.updateDiscoveryConnection({
@@ -694,6 +699,12 @@ export const connectionLostEpic = (action$: any, store: any) =>
694699
)
695700
} catch (e) {
696701
authLog(`Failed to refresh token: ${e}`)
702+
authLog(
703+
'This could be due to the refresh token not being available, which happens if Neo4j Browser accessed via stored credentials rather than redoing the SSO flow. ' +
704+
'If you have a short lived access token, it may be beneficial to set `browser.retain_connection_credentials=false` in neo4j.conf to make sure the refresh token is always available.'
705+
)
706+
// if refreshing the token failed, don't retry
707+
return resolve({ type: UnauthorizedDriverError })
697708
}
698709
}
699710
} else {

0 commit comments

Comments
 (0)