Closed ppetitto1 closed 2 years ago
The /connect/salesforce/callback
is used internally by Grant and this is the redirect_uri
that you set for your OAuth app in Salesforce.
Depending on the transport
that you want to use the response data will be available in one of 3 possible ways after that. Have a look at the examples and search for transport
. The first one to try is the querystring
one. For that you need to set the callback
property to point to a route on your local server, note that this is not your redirect_uri
as mentioned above.
Once you get that working then you can try the session
and the state
transports as well.
Thanks for the quick response. You were right! I commented out the transport type so it defaults to querystring and changed the calback to be some other /connect/provder/callback/token, and was able to see it.
Question though, when I pass the transport as session, does it still redirect to the callback url? or is this callback url ignored in this instance?
For querystring
transport the callback
is required. For session
transport it is optional, and for the state
transport it is not needed. You can read more about it here, but the gist of it is that you can use the state
transport example, but with the session
transport without providing a callback
. In that case you will receive the final response data inside the session object without the need of a redirect. Otherwise if you use session
transport along with a callback
you will be redirected to your callback route but instead of having the response data encoded as querystring it will be available in the session object.
Hello,
Love the library, looks really useful but I'm having an issue. I'm using fastify and trying to connect to Salesforce using the supplied provider, and overriding with the sandbox urls.
I have my provider configured like so...
Yet, in my callback... /connect/salesforce/callback
I call the response like request.session.grant.response and it logs out like
I can access a sessionId like request.session.sessionId... but I don't think this is salesforce sessionId.
Clearly I am missing something. I was under the impression the library would handle the full oauth2 process, including exchanging the temporary code for an access token. Is there additional configuration needed on my part, or will I need to handle the exchange process myself?
Thanks