I've come in such a circumstances where I need to pass authorization code without oauth login. User will be already login in salesforce and will be clicking on external link and that external server will be authenticated by using salesforce identity automatically.
Currently, when a hit is made to external server they redirect back to salesforce for OAuth2.0 and get the authorization code and after that they again make a request to get access token.
I just want to reduce one step to get authorization code by passing the code in URL parameter when first time we get redirected to external server. At that moment they will get Authorization code without making any extra call and will make only call to get access token.
So, my question is- is there any way to get authorization code that I can pass in external URL? Or do you know how it's generated?
I just tried to understand the pattern by observing the multiple codes generated through ouath and found that there is prefix which is always same in all codes like:
code 1: ayub.jdhajdbdkcbxncbnxcbzxcnbzhj==
Code 2: ayub.djbsjcbvdsjcvsbncvnbzcvbzcbcnzcvdcbc==
So, prefix ayub is same in each code but other remaining texts are different in each call.
I found one more question on developer forum but it's unanswered: https://developer.salesforce.com/forums/?id=906F0000000AxyYIAS