function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Singer-ClarkSinger-Clark 

How to get Metadata API server Url when using OAuth instead of username/password login request?

I'm trying to interact with Metadata API from Python, for multiple different Salesforce accounts / organizations.

I'm using OAuth flow so nobody needs to give me their username + password, and can just reuse the OAuth process we went through for use with REST API.

The docs say that the login request (which uses username + password) is how you get the sessionID and Metadata API server url in order to make subsequent requests. The docs (e.g. [here](https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_quickstart_java_sample.htm)) say you can use OAuth instead, and replace sessionID with the access token you get from OAuth.

But what about the other part, the server url? If OAuth replaces that login request, how can I get this Metadata API server url (or make requests without it, or whatever)?
pconpcon
As part of the resultant call from the oAuth login, you should get a serverUrl (or something similar) and you can pull the instance name out of that and then use that with the metdata api.