I have created an empty grails 2.4.5 web project and added the auth0 libraries to integrate the web application. That part was working properly. Then I added the Spring Security API dependencies following this manual: Auth0 Spring Boot API SDK Quickstarts: Authorization (there is no Auth0 manual for integrating a grails 2 api with auth0)
But I am getting the error attached in the text file: [link text]. I have pushed the code that shows this integration to a github branch:
Could you please give me some hints on how to make this integration possible?
I know there is a grails 3 example but that one uses spring boot.
GET http://localhost:8080/webandapi/publicapi → works ok
GET http://localhost:8080/webandapi/api (secured api, passing the token in Authorization header) → get error attached
Hi there, @ashish is currently looking at this and will respond back to you as soon as possible.
Hi @pascurra The error you are getting is this
Caused by NoClassDefFoundError: com/auth0/jwt/exceptions/JWTDecodeException You are most likely missing dependency for java-jwt library because that is where the JWTDecodeException class is defined. Please add it and let us know if that solves your issue.
Hello @ashish , thanks a lot for your help, we really appreciate it.
Here are the results of adding the dependency:
When I use the latest dependency:
compile group: ‘com.auth0’, name: ‘java-jwt’, version: ‘3.2.0’
There is a compilation error attached in this comment[link text]
It seems that the existing code was depending on an old version of java-jwt(2.2.1) that is included even before adding manually the java-jwt dependency
When changing to ‘java-jwt’, version: ‘3.2.0’ the code has missing dependencies, in some cases the dependencies were moved to another folder, but in other cases some classes are not just there anymore(Example: JWT.class)
When adding this dependency:
compile group: ‘com.auth0’, name: ‘java-jwt’, version: ‘2.2.2’
I get same error attached in this comment the [link text]
Could you please let us know which dependency should we use in this case? We need both the web application and the api functionality work in this project with auth0.
Thanks a lot for your help,
Hello @pascurra I have tried project provided via your Github and the API code si likely not provided. Both /publicapi and /api endpoints return
HTTP 404 Not Found.
I have just used the command
.\grailsw.bat run-app to build and run the application.
Hello @pascurra looking into java-jwt3-2-0.txt file, why do you have java-jwt copied into your source code folder src/java instead of using the dependencies?
Thanks a lot for your reply. The code that includes the API is in this branch:
The branch add-auth0-with-spring-security-api is where we need to integrate the api with auth0, and the merge back into our already working web app in the master branch(which contains a grails 2.4.5 web project integrated with auth0 for the web part)
Thanks a lot for your help
Thanks for your reply, java-jwt was not copied manually into the src/java.
What we have in /src/java are classes needed to integrate a grails 2.4.5 web app with auth 0, following the procedures documented in your website.
Here is the history of what was done to the branch reported:
As you can see it is a vanilla project integrated with auth0(web part) and we are looking to integrate also the spring security api using auth0 as well(in the same web app).
Thank you for your help.