Hey Harshitha,
Can you provide more information what kind of authorization you are using on your REST service?
I always suggest to use custom authentication with JWT token, where you can create custom logic where you can verify API.
You can read this post with my explination. https://forum.mendix.com/link/space/app-development/questions/130358
If you have more question please be free to ask more question.
Best regards, Slavko