OKTA Integration with GWT

Dear Team,

I am trying to integrate OKTA API in my application which is basically developed in GWT. While restarting the application I am getting an error and it looks like GWT is not able to compile the OKTA classes and not able to convert those classes into javascript. As I can not see any compatible GWT module which can translate these classes in javascript. Can we please look into this? I am attaching the snapshots of code changes which I have done and also errors I am getting. It would be very helpful If we resolve this issue.

As far as I know, you can’t use the Java SDK in GWT. It wasn’t built for use in a client-side, JS application. You should use it in your backend Java code.

Hey Mraible,

I used JAVA SDK but as you said it won’t work in the case of GWT. So here my concern is what if I want to integrate OKTA in my GWT-based application? My requirement is when I am hitting the login URL of my application, it should redirect to the OKTA login page and after successful login, it should come back to our Home Page. It would be very helpful if any solution would be there.


What is your backend written in? In JHipster, we have a sign in link that hits a backend endpoint that does the OAuth dance with Okta. Once everything is finished, it redirects back to the frontend (written in Angular, React, or Vue) and the user is authenticated. The communication between the frontend and backend is managed through good ol’ session cookies. This is more secure because JWTs are not a good replacement for session cookies.

My frontend is GWT (Google Webtool Kit) and the Backend is Java Servlets. No Jhipster,angular,react,vue

You can integrate Spring Security with Java Servlets (aka plain ol’ Java EE) and get the same behavior that we’ve implemented in JHipster. See this URL for a blog post I wrote on this topic. Build a Java REST API with Java EE and OIDC | Okta Developer