Reading URI fragments vaadin 23 JAVA

Hello i want to read URI fragments like http://localhost/login#token=123 . I need to read token value. Is there any way to read it ? I work on vaadin v23.

URI fragments are not sent to the server. You should probably use Javascript on the client side to read it and then send it to the server, for example with a @ClientCallable

@versatile-zorse I try it but nothing happend. I want to print that variable to console.
Here is my code
UI.getCurrent().getPage().executeJs(
“if(window.location.hash) {” +
" var hash = window.location.hash.substring(1); " +
“return hash;”+
" }").then(s → {
System.out.println(s.toString());
});

Your code works for me. I just replaced the s.toString() with s.asString() to get the value of the JSON parameter instead of the Java object representation

thx work with asString()