react-adal icon indicating copy to clipboard operation
react-adal copied to clipboard

perform login on request

Open mdmoin7 opened this issue 5 years ago • 4 comments

how can i implement login at some specific point, the current implementation forces the user to login as soon as you launch the app or open the home page, what if the home page isn't protected page is login a mandate there. How to avoid this.

mdmoin7 avatar Feb 02 '20 13:02 mdmoin7

If you are using react router, you can define which pages are public and which pages will be protected. Take a look https://reacttraining.com/react-router/web/example/auth-workflow

juagarciaga avatar Feb 02 '20 21:02 juagarciaga

I have already done that as per the readme you have provided an hoc for the same. But the problem is in index.ts we create the authentication context so as soon as app loads it redirects to the login page which I do not want, it should preferably redirect only on protected pages rather than just making the user login on first load.

mdmoin7 avatar Feb 03 '20 01:02 mdmoin7

In the index.ts example you have a constant variable which is a Boolean if I try changing that value it never asks for login even protected pages are accessible without login than.

mdmoin7 avatar Feb 03 '20 01:02 mdmoin7

@mdmoin7 were you able to make this work ? If so can you please share it. I'm facing the same problem.

cc: @salvoravida

Senelith avatar Oct 26 '20 17:10 Senelith