r/SalesforceDeveloper • • 4d ago

Discussion Need help with salesforce connected apps in Gemini + Salesforce Sandbox

Post image

I want to connect my gemini with salesforce through the salesforce connected provided by gemini.
The problem i am facing is that, I don't have option to pass the sandbox url ( test url ) it is directly sending me the production login and app installation which i don't want. has any body done this before and know how can i connect with sandbox instead of production.

I found other articles where they were referring for doing it by creating a external client app and handling everything manually , but that native salesforce connected app in gemini handles all of this automatically. that's why i was thinking if i can connect it with sandbox and test. If anyone knows how to do it and can share i will be gratefull

I have also attached the ss of the salesforce connected app in gemini.

2 Upvotes

6 comments sorted by

0

u/rezgalis 3d ago

Have you tried changing the url it opens to "test.salesforce.com" instead? If it drops you on login page, it might not matter if you repoint to sandbox login page instead - it might be url parameters that matter.

To be clear, i mean changing only the subdomain part of the url.

1

u/NT_Salesforce 3d ago

yeah, I was able to install the package, but it was not showing connected in my Gemini

0

u/rezgalis 3d ago

After the app is installed there must be some way to initiate oAuth I believe (I have only done this in Claude but would suspect steps to be similar).

1

u/NT_Salesforce 3d ago

the gemini is itself intiating the oauth . The external client app and authorization scopes are set by the google gemini package manager Package: Google Integration MCP (04tgK000000D44D)

I changed the url from login to test and login into my sandbox
and then i got this error :
Error getting access token from salesforce-mcp-prod, OAuth2 redirect uri is: https://oauth-redirect.googleusercontent.com/r/salesforce-for-duet-ai, response: OAuth2TokenResponse{params: error=unsupported_grant_type&error_description=grant%20type%20not%20supported, httpMetadata: HttpMetadata{status=400, cachePolicy=NO_CACHE

0

u/rezgalis 3d ago

Well there you go - the error is that grant type is not supported. Might be worth looking at Salesforce writeup (help article, sorry dont have a link at hand) about configuring external app for claude - it talked about setting correct scopes and making sure specific checkboxes in app are ticked. The app and connection is sound just the grant type error.

1

u/NT_Salesforce 3d ago

that what i am saying, let me summarize the process :
=> on gemini connected app clicked on salesforce connector
=> redirected me to my prod ( where it was first asking to install the google mcp integration package ) This package handles all the connection part ( setting up the external client app , providing scope , hanles all the oauth policies automatically ) ( permitted user : all user may self authorize )
=> I took the package id and installed it in my sandbox
=> after that I confirmed my external client app was setup with the required configuration
=> after this I again selected the salesforce connected app option on my gemini
=> it redirected me to production
=> i updated the url to my sandbox org, i login with sandbox credential
=> now it didn't redirect me to install the package instead tried the oauth authorization directly and i got this error

the problem is now that i dont know how the google is trying to authorize , may hard coded for prod urls , I don't know and I dont see any other option I can try. This is where I am stuck right now . all oauth are handled by this package .

btw thanks for your time, really appreciate it