-
Notifications
You must be signed in to change notification settings - Fork 1
Acn microsoft login #5
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ed32ccb
feat: acn mircosoft login
AlexOp1403 665e638
feat: add microsoft login
AlexOp1403 8db4b40
feat: email as param for login and removed google login
AlexOp1403 926b07d
fix: actions jobs syntax
AlexOp1403 ad9c468
Merge branch 'main' into acn-microsoft-login
AlexOp1403 79e91f9
feat: acn mircosoft login
AlexOp1403 b6c6bbc
feat: email as param for login and removed google login
AlexOp1403 efa4d70
fix: .env.example fix
AlexOp1403 cad6e46
fix: make handlelogin async and check for email beforehand
AlexOp1403 ad1602f
feat: login now as popup
AlexOp1403 2147c42
feat: set client id for env and fix format job
AlexOp1403 a9ccbbd
fix: fix deploy job
AlexOp1403 a247cd8
fix: fullscreen login
AlexOp1403 e8fba07
chore: formatting
AlexOp1403 bbf4bf2
fix: review findings
AlexOp1403 41a527a
fix: format job
AlexOp1403 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import React, { ButtonHTMLAttributes } from 'react' | ||
| import AppHistory from '../app-history' | ||
| import { PrimaryButton } from './button' | ||
| import { useMsal } from '@azure/msal-react' | ||
| import { loginRequest } from '../hooks/ms-auth' | ||
| import { useAuthentication } from '../hooks/use-authentication' | ||
| import { useLoginPageLoginMutation } from '../graphql' | ||
| import { useIsAuthenticated } from '@azure/msal-react' | ||
|
|
||
| export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> { | ||
| fullsize?: boolean | ||
| } | ||
|
|
||
| export const SignInButton: React.FunctionComponent<ButtonProps> = () => { | ||
| const { instance } = useMsal() | ||
| const { login } = useAuthentication() | ||
| const [mutate] = useLoginPageLoginMutation() | ||
| const isAuthenticated = useIsAuthenticated() | ||
|
|
||
| const handleLogin = async () => { | ||
| const loginResponse = await instance.loginPopup(loginRequest) | ||
| if (isAuthenticated) { | ||
| const email = loginResponse.account?.username | ||
| if (email) { | ||
| mutate({ variables: { email } }) | ||
| .then((response) => { | ||
| const { data } = response | ||
| if (!data?.login) { | ||
| return AppHistory.getInstance().push('/no-user-found') | ||
| } | ||
| login(data.login) | ||
| }) | ||
| .catch((err) => { | ||
| console.log(err) | ||
| }) | ||
| } | ||
| } | ||
| } | ||
| return <PrimaryButton onClick={() => handleLogin()}>Sign in with Microsoft</PrimaryButton> | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| export const msalConfig = { | ||
| auth: { | ||
| clientId: ENVIRONMENT.microsoftClientID ?? '', | ||
| authority: 'https://login.microsoftonline.com/' + ENVIRONMENT.microsoftTenantID, | ||
| redirectUri: ENVIRONMENT.frontendUrl, | ||
| }, | ||
| cache: { | ||
| cacheLocation: 'sessionStorage', | ||
| storeAuthStateInCookie: false, | ||
| }, | ||
| } | ||
|
|
||
| export const loginRequest = { | ||
| scopes: ['User.Read', 'openid', 'profile'], | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.