How to fetch CloudID for the domain chosen by the user in Jira Oauth(2.0) app

Hi there, I am trying to integrate my third party application using Oauth2.0 App provided by Jira. After configuring the app on the jira side when we access the Authorization URL, the user is made to choose one of the “Domains” he has access to. After fetching the access token, we need to get the “cloudId” of the selected domain, post which we can make rest api calls.
My requirement is to fetch the cloudId of the domain which the user selected in the first place while giving the access through the authorization url. In the documentation it is written that we need to fetch the cloud id of all the accessible domains using -https://api.atlassian.com/oauth/token/accessible-resources
which gives us a list of all the domains the user has access to. Now how do I filter out the domain which the user selected in the very first page.
Please give me any solution and feel free to ask any more details of my use case.