How to use gradio client library in next.js to call API built using gradio space and the space is private?

I am trying to use the API provided after I built space in hugging face using gradio in next.js. But the problem is that the space is a private space. I am providing the token as follows but the issue arises as it calls as space-url/jwt as header and 404 error not found arises. How to solve this issue?