Could anyone please clarify my doubts. If I use Authentication Protocol as Oauth 2.0 and provide an Authentication Provider for the same with required settings and call a rest end point of different org
then how does the underlying mechanism differs from the below sample code?
If we do not use named credentials and handle it in apex then we only require to hit token end point of salesforce and the grant_type needs to be specified as passwords. But if we use named credentials with Authentication Protocol as Oauth 2.0, then we need to specify authorization end point and token end. So does it mean if we use Authentication Protocol as Oauth 2.0 the grant_type implicitly becomes authorization_code