Skip to content

Commit 598ae3f

Browse files
committed
remove popup when creating an account
1 parent 72db27a commit 598ae3f

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

1-Authentication/1-sign-in-react/SPA/public/redirect.html

Lines changed: 0 additions & 6 deletions
This file was deleted.

1-Authentication/1-sign-in-react/SPA/src/App.jsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,14 @@ const MainContent = () => {
2121
const { instance } = useMsal();
2222
const activeAccount = instance.getActiveAccount();
2323

24-
const handleLoginPopup = () => {
25-
/**
26-
* When using popup and silent APIs, we recommend setting the redirectUri to a blank page or a page
27-
* that does not implement MSAL. Keep in mind that all redirect routes must be registered with the application
28-
* For more information, please follow this link: https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/login-user.md#redirecturi-considerations
29-
*/
24+
const handleRedirect = () => {
3025
instance
31-
.loginPopup({
26+
.loginRedirect({
3227
...loginRequest,
33-
redirectUri: '/redirect',
34-
prompt: "create"
28+
prompt: 'create',
3529
})
3630
.catch((error) => console.log(error));
37-
}
31+
};
3832
return (
3933
<div className="App">
4034
<AuthenticatedTemplate>
@@ -45,7 +39,7 @@ const MainContent = () => {
4539
) : null}
4640
</AuthenticatedTemplate>
4741
<UnauthenticatedTemplate>
48-
<Button className='signInButton' onClick={handleLoginPopup} variant="primary">
42+
<Button className="signInButton" onClick={handleRedirect} variant="primary">
4943
Sign up
5044
</Button>
5145
</UnauthenticatedTemplate>

0 commit comments

Comments
 (0)