charfedine
yeah thanks it worked but after finishing the implementation of the code. I tried to run it but got this error :
+ " org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘securityConfiguration’: Unsatisfied dependency expressed through method ‘setContentNegotationStrategy’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration’: Unsatisfied dependency expressed through method ‘setConfigurers’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.security.config.annotation.web.configuration.OAuth2ClientConfiguration$OAuth2ClientWebMvcSecurityConfiguration’: Unsatisfied dependency expressed through method ‘setClientRegistrationRepository’ parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientRegistrationRepositoryConfiguration’: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘spring.security.oauth2.client-org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties’: Invocation of init method failed; nested exception is java.lang.IllegalStateException: Client id must not be empty. "
Any solution please ?
Matt Raible
The last line in the error seems to indicate the problem. Make sure you have all your OIDC app’s properties specified in src/main/resources/application.yml
. It looks like you forgot to paste your Client ID into this file.
charfedine
yeah checked it and turns out that i made a typing error !
Now after implementing the RedirectController.java so it can redirect me back to my app after connecting to my okta account BUT Now i’m getting this Whitelabel Error Page !
Minju
I’m having a problem with the okta authentication … It doesn’t not work.
I download the github yesterday. And I changed only application.yml for connectiong my okta app.
spring boot Run → yarn start → localhost:3000 → Login Click → okta login → but I can’t login… https://uploads.disquscdn.c…
Please Help me… I can’t anything to solve this problem for 3 days…
Matt Raible
I’m guessing you have something misconfigured since it works with my Okta tenant. Can you send your application.yml to me so I can try it? My email is matt.raible@okta.com.
Minju
I send the email!! If I have the problem with the application.yml please get back to me!
Matt Raible
If you’re getting an error, my guess is you’re not running it with the prod profile. Try running:
./mvnw spring-boot:run -Pprod
Matt Raible
Hello Minju,
Thanks for sending me an email with your application.yml
and creating an account for me to log in to your Okta tenant. Unfortunately, I’m unable to reproduce your problem. When I log in to the application with your tenant’s information, it all works as expected. See proof below.
https://uploads.disquscdn.c…
I would make sure the clock on your computer is synched with a time service. If your clock doesn’t match Okta’s, you’ll have problems validating JWTs.
jacob d
I got this same error because I had pasted the proxy line in the wrong place. Proxy should be after scripts, not in it.
Here is part of my package.json to show how it should look:
“scripts”: {
“start”: “react-scripts start”,
“build”: “react-scripts build”,
“test”: “react-scripts test”,
“eject”: “react-scripts eject”
},
“proxy”: “http://localhost:8080”,
“eslintConfig”: {
“extends”: “react-app”
},
David Jacob
Hi Matt.
I think what the OP is referring to is there are two versions of the updateGroup method in GroupController.java that you’ve written in this blog post.
The first one defines the PUT with this annotation:
@PutMapping("/group/{id}")
And second one (and the one in the repo) defines it like this:
@PutMapping("/group")
So when you first define the handleSubmit function in GroupEdit.js, it tried to PUT to ‘/api/group/’, which obviously doesn’t work for the first PUT endpoint. I guess the first version above was an earlier version and you just forgot to change it. I changed my GroupController.java to use the ‘/group’ endpoint and removed references to ‘id’ and it works now.
Matt Raible
I see what you’re saying David. This post should not have the following method:
@PutMapping("/group/{id}")
ResponseEntity<group> updateGroup(@PathVariable Long id, @Valid @RequestBody Group group) {
group.setId(id);
log.info(“Request to update group: {}”, group);
Group result = groupRepository.save(group);
return ResponseEntity.ok().body(result);
}
I’ve corrected things and replaced it with:
@PutMapping("/group")
ResponseEntity<group> updateGroup(@Valid @RequestBody Group group) {
log.info(“Request to update group: {}”, group);
Group result = groupRepository.save(group);
return ResponseEntity.ok().body(result);
}
David Jacob
Looks good!
Thanks for the long, detailed blog post btw. I’m finding it very helpful.
Filipev Eugene
Hi, Thank you for the great tutorial. Everything works perfectly for me. I would like to ask you how to do the same logout with Google Api? Login works well but when I’m trying to do logout java.lang.NullPointerException occurs. OidcIdToken is null.Should I write my custom LogoutHandler or I can make logout function work with some changes?
hemanshu
iDownloaded from github , imported to STS, maven update, generated setters/getters to User , group - , ii am getting following build errors
The constructor Group(String) is undefined Initializer.java
The constructor User(String, String, String) is undefined GroupController.java
The method builder() is undefined for the type Event Initializer.java
The method save(S) in the type CrudRepository<group,long>
is not applicable for the arguments (Group) Initializer.java
Matt Raible
It sounds like you need to configure Lombok for Eclipse.
Matt Raible
You probably need to configure your app on Google to return an ID token as well as an access token. I’m not sure though. The logout used in this tutorial might not work with Google as your IdP.
hemanshu
Hi, Thanks for solving the above problem , I could compile and run spring on my PC , for react - i did “npm install” and then “yarn start” in the app folder of REACT SCRIPT , I created developer account in OKTA. changed the issuer-url to developer account server , do not know my client id , client secret values to change ( do i need to change , if yes - where do i get my values for application.yml ). without changes to client id , secret -, on browser http://localhost:3000 , i am getting login page , clicking login button i get 400 bad request
hemanshu
got it, reread the article and found setup required to okta . one has to register for developer login to do setup , article gives setup DEFINING for application to OKTA, which gives Client id , Client Secret - , setup is given in article , after setting in application.yml accordingly , Application works , , however Manage JUG Tour on begining of app on login does to take to http://localhost:3000/groups - one has to put in url …to go for group functionality for firefox( need to test again ) , however it works properly in Chrome.
Praneetha CK
Hello, I set up NODE_PATH=src in .env file in my front-end folder so that I can use absolute imports, i.e allowing imports such as “import images from assets/images”. where assets is a direct child of src. But this gives an error when it is built through maven.
Reysan
Welcome, i wonder how can I select Event value during editing or creating Group? I try something with <select> but it won’t working