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
ATHUL MATHEW 18ATHUL MATHEW 18 

oauth failing

i have created a rest webservice for an external system to send updates about our lead. i have trouble getting through OAUTH 2.. how can i bypass the need for a user at  their end to manually enter username password.
First i used password grant type..it worked initially then failed after few requests.The error shown was invalid grant type... Then i tried grant type as autherization_code, that was succesfull with postman but there is the need to manually enter username password. I want to bypass that requirement of a user manually entering username and password....Kindly help which AUTH flow should i use
VinayVinay (Salesforce Developers) 
Hi Athul,

Can you share screenshot for same and provide with steps to replicate the issue.

Thanks,
ATHUL MATHEW 18ATHUL MATHEW 18
Thanks for the response sir....can u give the documentation for different grant types in OAuth2 
VinayVinay (Salesforce Developers) 
OAuth2  allows three grant types in salesforce.
  • Password
  • JWT
  • Refresh Token
Also you can check common OAuth grant types below.
https://oauth.net/2/grant-types/

Please mark as Best Answer if above information was helpful.

Thanks,
ATHUL MATHEW 18ATHUL MATHEW 18
sir what about client_credentials and authorization_code.....i implemented using both of them but my requirement was the client_credentials flow...can u provide the salesforce documentation for OAuth2
VinayVinay (Salesforce Developers) 
Not sure if that will work, here is the documentation for setting up authorization with OAuth 2.0.

https://developer.salesforce.com/docs/atlas.en-us.api_streaming.meta/api_streaming/code_sample_auth_oauth.htm
https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_web_server_flow.htm&type=5

Thanks,
ATHUL MATHEW 18ATHUL MATHEW 18
there shouldnt be the need for a user entering username and password manually at their end, so in this case i have to go with password grant_type right?... I have created an integration user. so its okay to share the user credentials right? Sorry if that question is dumb iam pretty new here