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
Nishchal Vashisht 1Nishchal Vashisht 1 

Can I use SSO credentials to hit my service org Web Service Class in Salesforce?

I have implemented SSO among two ORGS. I have made a web services class in my service Org. Can I hit that web service from my Identity provider Org using rest callout? I tried it by making a http get request which for which I use following URL pattern (service Org Url + Urlmap to Web service class) as a response I got 302 status with updated URL, Too handle this I used following code.

while (response.getStatusCode() == 302) {
       request.setEndpoint(response.getHeader('Location'));
        System.debug('END Location isi '+response.getHeader('Location'));
        response = new Http().send(request);
    }
 

I was hitting this point https://cloudce-13a-dev-ed.lightning.force.com/Case/abc but it redirected to https://cloudce-13a-dev-ed.my.salesforce.com/Case

Response of second link comes 404 not found

VinayVinay (Salesforce Developers) 
Hi Nishchal,

I dont think you can use your SSO credentials to invoke class,  you would need to use api user credentials to make http callout.

Thanks,
Nishchal Vashisht 1Nishchal Vashisht 1

@Vinay then what is the purpose of link we have given in Single Sign On setting Tab

OAuth 2.0 Token Endpoint  https://cloudcetude-13a-dev-ed.my.salesforce.com/services/oauth2/token

User-added image