Question: I am trying to add a script on my Wordpress site.
Using jQuery I want add an "onChange" event to a numeric input (which belongs to the Calculated Fields Form plugin).

When I type something in the input field, nothing happens. It should have printed `onChange` in console.

So the problem is that the jQuery functions are not registering.

HTML:

```
<input id="fieldname2_1" name="fieldname2_1" min="1" type="number">

```

functions.php file:

```
function numeric_input_script() {
    wp_enqueue_script(
        'numeric-input', // naming my script so that i can attach other scripts and de-register, etc.
        get_stylesheet_directory_uri() . '/numeric-input.js', // this is the location of the script file
        array('jquery'), // this array lists the scripts upon which my script depends
        null, // version number
        true // states that the script needs to be loaded in the footer
    );
}
add_action( 'wp_enqueue_scripts', 'numeric_input_script' );

```

JS file:

```
jQuery(document).ready(function($) {
    console.log('Loading'); //shows up

    $('#fieldname2_1').on('change', function() {
        console.log("onChange"); //code inside this function does not work
    })

    console.log('Loaded');  //shows up
});

```

Things that I have tried, but with no success:

* buttons and other events;
* enqueuing the script after the header (last param of `wp_enqueue_script` set to false);
* using `var j = jQuery.noConflict();` and using `j` instead of `$`.

Any help would be appreciated. Thanks!

Answer: 
From [Spring Security's documentation](https://docs.spring.io/spring-security/site/docs/5.2.x/reference/html/oauth2.html#customizing-the-access-token-response-2):

> 
> The OAuth2RefreshToken may optionally be returned in the Access Token Response for the authorization\_code and password grant types. If the `OAuth2AuthorizedClient.getRefreshToken()` is available and the `OAuth2AuthorizedClient.getAccessToken()` is expired, it will automatically be refreshed by the `RefreshTokenOAuth2AuthorizedClientProvider`.
> 
> 
> 

Checking the refresh token box in your Okta app is not enough to get a refresh token. You also need to pass in an `offline_access` scope or it won't be returned.

I'd recommend you upgrade to the Okta Spring Boot starter 2.0.0 and use the following scopes property:

```
okta.oauth2.scopes=openid, email, profile, offline_access

```
If you have the refresh token, you could [send it to the /token endpoint to get a new access token](https://developer.okta.com/docs/guides/refresh-tokens/use-refresh-token/). You'd just want to decide if you fetch the new token pre-emptively (based on when it will expire) or re-actively (requesting a new access token if the existing one stops working).