I am integrating with GoToWebinar using a Named Credential to make Apex Callouts. While the Authentication piece is working well, during the Callback to get the access token, there are some additional attributes:

 "access_token": "eyJraWQiOiJvYXV0aHYyLmxt666...",
  "token_type": "Bearer",
  "refresh_token": "eyJraWQiOiJvYXV0aHYyLmxt999...",
  "expires_in": 3600,
  "account_key": "9999982253621659654",
  "account_type": "",
  "email": "mister.jones@fakemail.com",
  "firstName": "Moon",
  "lastName": "Beam",
  "organizer_key": "8439885694023999999",
  "version": "3"

That I would like to use a Merge field in my callout (i.e. {!$Credential.organizer_key}). Is this possible or do I have to manually perform all of this in Apex

  • Does this answer your question? Named Credential authentication with GoToWebinar (OAuth2)
    – identigral
    Sep 24 '20 at 17:28
  • No, it doesn't talk about how to get the organizer_key from the merge field Sep 24 '20 at 17:36
  • That JSON is a response from GoTo. Named Credentials + merge is for requests. For parsing the response, have a look at Deserializing JSON in Apex
    – identigral
    Sep 24 '20 at 17:42
  • I understand that is it coming back from GoTo. What I am trying to understand is if Salesforce is capturing the entire JSON during the Named Credential callback, and then I can use the other attributes (i.e organizer_key) as a merge variable for future callouts Sep 24 '20 at 18:30
  • 1
    Only the access token from the response is available as a merge field for callouts.
    – identigral
    Sep 24 '20 at 18:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.