3

The Connected App was created in Prod and brought over to the sandbox during refresh. I see that the Consumer Key and Consumer Secret are different. What do I need to do to get it back up and running properly ? Do I need to bring the same Consumer Key and Consumer Secret back over to the sandbox somehow ? Or is it a matter of creating a whole new Initial Access Token sandbox token and having that used somehow ?

Thank you for any help.

Update :

Here is my Postman screen as I see it now :

enter image description here

2 Answers 2

5

The Consumer Key must be globally unique in Salesforce, across all instances. This is a UUID that is linked to that specific instance of the Connected App. The Consumer Secret is generated automatically, but you can change it with a metadata deployment. However... you don't necessarily need to. All Consumer Keys are valid for all orgs globally. However, if you create a Connected App in a Sandbox, be aware that it will be deleted forever upon refresh. You should always create Connected Apps in orgs that are permanent.

1
  • Thank you very much @sfdcfox - I think I am about to delete the Connected App in the sandbox and rebuild it. I am going to try and build the rest with the instructions Derek provided above if I can figure out how to use Postman.
    – Zoom_v
    Commented Apr 21, 2022 at 19:42
3

In the past, I've simply

  1. deleted the copy of the connected app in the refreshed sandbox
  2. then gone through the web-server OAuth 2.0 flow with the customer key (and secret, if required) from production

The first part is accomplished in Lightning Experience through
Setup -> Home tab -> Apps (under the "Platform Tools" header) -> App Manager.

You click on the triangle to expand the options, and you want to select "View". If the "View" option isn't present and you only see "Manage", then that Connected App was installed in your org from another org (as opposed to being defined within your sandbox org, which is the case for the copy that appears after a refresh). You need to delete the copy from your sandbox so that you can install the "real" version from your production org.

The second part can be accomplished through Postman (it can also be done through other means, including a plain 'ol web browser). Instructions using Postman:

  • Open a new tab for a request
  • Go to the "Auth" tab in the request window
  • Set Type to "OAuth 2.0", and Add authorization data to "Request URL"
  • In the Configuration Options, use Grant Type "Authorization code"
    • Callback URL, Client Id, and Client Secret are all taken from your connected app in production
    • The Auth URL and Access Token URL have the same base, "https://yourdomain--sandboxname.my.salesforce.com/services/oauth2". The auth url ends with "/authorize" and the token url ends with "/token"
    • Keep "Authorize using browser" unchecked
    • Client Authentication should be "Send client credentials in body"

You can then push the "get new access token" button, which should cause the usual OAuth window to pop up.

7
  • I'm confused with the second part of your answer. I've never used Postman. Is the second part of your answer involving having a Postman account and being logged into it ? Thank you so much for your input !
    – Zoom_v
    Commented Apr 21, 2022 at 19:37
  • 1
    @Zoom_v You should be able to use Postman without having an account with them (if you use the desktop app).
    – Derek F
    Commented Apr 21, 2022 at 19:46
  • I've made an account using Postman site. I've gotten to the point of setting the Configuration Options use Grant Type "Authorization code". From there I was confused what to do next. I also don't see an "Auth URL" or "Access Token URL". I've included a screen shot of my Postman screen in my original post if that helps...? Thank you so much.
    – Zoom_v
    Commented Apr 21, 2022 at 20:31
  • So, I've decided to completely rebuild the Connected App from scratch inside the sandbox. I'm not sure what I need to do besides that. I'm trying to follow Derek's instructions in Postman. It's my first time ever using Postman. I'm confused on what is needed with that. I've included a screen shot of my current Postman process. If you can give me any directions I would really appreciate it. Thank you.
    – Zoom_v
    Commented Apr 22, 2022 at 13:40
  • @Zoom_v You should be able to scroll down (while you hover over the right sub-panel where you see "Configure New Token") to see the other fields.
    – Derek F
    Commented Apr 22, 2022 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .