How to use wp_create_nonce() to get user ID in WordPress Rest Api

I know a lot of questions have been asked about this topic but I have had no luck implementing their code. I want to be able to use get_current_user_id() inside my WordPress Rest Api. This is what I have so far:

functions.php

js