How to connect to a salesforce org to another salesforce org using web based login and without a connected app.
I want to connect to sandbox orgs from prod org and do not want to create connected apps. Is there a way we can login using the web based login flow ?
After creating names credential as @sfdcfox mentioned below, I get the Unauthorized access, 401 error. I used the named credential as follows
String restUrl = 'callout:TestNamedCredential/services/data/v42.0/limits';
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(restUrl);
req.setMethod('GET');
Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(restUrl);
req.setMethod('GET');
req.setBody('UserName:{!HTMLENCODE($Credential.Username)}');
req.setBody('Password:{!HTMLENCODE($Credential.Password)}');
HttpResponse res = h.send(req);