# Accessing theme-resources inside packed jar custom authenticator

**URL:** <https://forum.keycloak.org/t/accessing-theme-resources-inside-packed-jar-custom-authenticator/26979>\
**Category:** Extending the server\
**Tags:** authentication, themes\
**Created:** [July 12, 2024, 1:49am UTC](https://forum.keycloak.org/t/accessing-theme-resources-inside-packed-jar-custom-authenticator/26979 "2024-07-12T01:49:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed.Mabrouck](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/ahmed.mabrouck/32/10879_2.png) [@Ahmed.Mabrouck](https://forum.keycloak.org/u/Ahmed.Mabrouck)\
**Post date:** [July 12, 2024, 1:49am UTC](https://forum.keycloak.org/t/accessing-theme-resources-inside-packed-jar-custom-authenticator/26979/1 "2024-07-12T01:49:14Z")

</div>

Hello All,

I am developing a custom FormAuthenticator and I would like to add the form a JavaScript file to the form using form.addScript(). The script in under theme-resources/resources/scripts inside the JAR as shown in the screenshot. I tried by all means but it did not help at all, and loading the script logs 404 error in the console as it is not found.

I would appreciate if anyone can help with that.  
 ![Screenshot 2024-07-12 044808](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/c/c81c81818da7cf190e8c1477ab9ab4b21c221cb7.png)

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [July 12, 2024, 5:12am UTC](https://forum.keycloak.org/t/accessing-theme-resources-inside-packed-jar-custom-authenticator/26979/2 "2024-07-12T05:12:20Z")

</div>

This can easily be achieved with code like this:

```java
@Override
public void buildPage(FormContext context, LoginFormsProvider form) {
  ...
  Theme theme = context.getSession().theme().getTheme(Theme.Type.LOGIN);
  UrlBean urlBean = new UrlBean(context.getRealm(), theme, new URI(""), null);
  form.addScript(urlBean.getResourcesPath() + "/scripts/timer.js");
  ...
}

```
