Closed joepardi closed 5 years ago
why not use okta-auth-js, don't be trapped in react
I have to use React as that's my teams' preferred choice. We also use Ant Design but no one has integrated with Okta yet. Since this is a new application, I thought Ant Admin was good for the initial scaffolding but the dynamic routes done by umi/dva are making it a challenge to put the correct Okta hooks in place. I swapped out the standard Ant Admin login page and put in the SignInWidget widget. I can get the app to display the Okta login page and post the credentials back to Okta. I can see the /implicit/callback route being invoked. The Okta cookies are being created, but for some reason the equivalent Okta objects are not being parsed and created within localStorage. Since this doesn't occur, auth.isAuthenticated() returns false and thus the app is not considered logged in yet.
I'l play around some more but was hoping someone already solved this before me.
how about put a minimal demo to have a look?
@superlbr - I have a minimum version mostly working. Feel free to submit changes. The current state of it:
ISSUES:
NOTES: A. public repo is https://github.com/joepardi/antadminokta B. see /mock/user.js for the Okta user to test with ... adamant@sample.com is setup on the Okta service. C. see the //OKTA marked comments within the code
I'll get some more time later today to see if I can fix the remaining two issues.
Agreed. I removed the
These changes are now in the repo.
@superlbr - your changes fixed the routing issues (hooray!). One small thing, however. The new callback entry in /mock/route.js shows up on the sidebar menu. Any suggestion on how to get it to not show but still remain valid as a route? Can that be done in the JSON or does it need to be hidden in the code somewhere?
Found it ... by setting menuParentId: '-1'
, the layout's
Has anyone gotten Ant Admin to use Okta for its login? I have Okta working on a regular Material-UI React application but can't get it to work with Ant Admin. Any help would be appreciated.