I am facing some problem on managed package. I have integrate Salesforce with Google Drive my problem is that i have set Redirect URl on Google drive App now when I installed this package in my another org that time Redirect URl change because my org have a different base URL.

I am getting Redirect URL mismatch problem, How I can solve this problem in salesforce Any help will be very appreciable.

Thanks in Advance

  • Are you using "managed release" or "managed beta"? Jan 7, 2016 at 8:31
  • @Ravikant Did you find any solution for this? I am having the same problem with my managed package code. Mar 6, 2019 at 9:22
  • @SagarThoriya have you found the solution?)
    – bananka
    Nov 1, 2019 at 11:14

2 Answers 2


You need to setup a new app in customer Google Account which will have

  1. Redirect URL for customer Org

  2. And a unique Client Id and Client secret.

    You should use these three things from custom setting, so that after installing the manged package and creating a new Google app, you can set those values to custom setting.

You create a installation documentation for the customers which can include these steps.


  • I don't want to create a new application each time after installing package. Jan 7, 2016 at 8:36
  • It is not a good Approach. Jan 7, 2016 at 8:36
  • I want to use same approach like "Cirrus Files for Google Drive" app exchange product in which we don't need to set these value each time. Jan 7, 2016 at 8:40
  • Best approach is to create a new app per org for security reasons. As no good company will allow your app to manage there google account. If you really want to use only one app you can pass your org redirect url into state parameter of request and your registered redirect url will call complete the auth flow and will redirect the last response to state url. Jan 7, 2016 at 8:54
  • Let me know if you need detail help in above approach. Jan 7, 2016 at 9:02

One of the approaches would be create 2 apps for production and sandbox environment and make redirect urls like this:

https://login.salesforce.com/apex/<package prefix>__<page name>
https://test.salesforce.com/apex/<package prefix>__<page name>

That would work for every production or sandbox org respectively.

You also need to make some logic in auth process to pick correct app during auth by checking if org is sandbox or not.

  • In Google app , You can add more then one redirect url. Jan 7, 2016 at 9:22
  • If you will add above URL's mentioned by you,it will redirect you to login page. Jan 7, 2016 at 9:23
  • @SFDCGOD those are working fine for me. Did you test that?
    – kurunve
    Jan 7, 2016 at 9:26
  • 1
    I have tried your solution and they did not work ,as whenever google redirect to login.salesforce.com, it opens login screen Jan 7, 2016 at 11:25
  • We can add only 25 redirect url on google application, after this it will not work. so i think this approach is not good to achieve our task. Jan 12, 2016 at 10:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.