You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems the package is designed to obtain its own session. I'm working from the idea that a calling org will provide a session for me to use and I do not obtain my own.
To make this work I needed to override part of the Session package but still provide a set of fake Credentials just to get a session created.
I wanted to put this up for discussion before I tried to mangle the package via PR.
I changed session.sessionPasswordResponse to be exported then created an alternate session.Open function that would accept it in and create a Session without trying to login. Staying compatible with the current Session interface so I could pass my session to your systems.
I don't think this solution is very clean because it still requires a sfdc.Configuration object with all the OAuth properties.
// SessionPasswordResponse is the relevant connection details for SalesforcetypeSessionPasswordResponsestruct {
AccessTokenstring`json:"access_token"`InstanceURLstring`json:"instance_url"`TokenTypestring
}
// Open is used to authenticate with Salesforce and open a session. The user will need to// supply the proper credentials and a HTTP client.funcOpen(config sfdc.Configuration, resp*SessionPasswordResponse) (*Session, error) {
ifconfig.Credentials==nil {
returnnil, errors.New("session: configuration crendentials can not be nil")
}
ifconfig.Client==nil {
returnnil, errors.New("session: configuration client can not be nil")
}
ifconfig.Version<=0 {
returnnil, errors.New("session: configuration version can not be less than zero")
}
session:=&Session{
response: resp,
config: config,
}
returnsession, nil
}
The text was updated successfully, but these errors were encountered:
this is not the case. If you look at the session package, you just need to provide the session interfaces to any of the rest api calls. This allows the user to open a session any way that they would like and just implement the interfaces.
I'm sorry, I don't think I stated my concern well. There is nothing in the package that is ready to accept a raw session & org URL. I did end up implementing something that satisfies the interfaces and leveraged that in my project, a little simpler than what I placed above.
Is there interest in having a built in part of the project to do this? If so, do you have a preference in how it is implemented? I'm happy to do it and get a PR back to you.
It seems the package is designed to obtain its own session. I'm working from the idea that a calling org will provide a session for me to use and I do not obtain my own.
To make this work I needed to override part of the Session package but still provide a set of fake Credentials just to get a session created.
I wanted to put this up for discussion before I tried to mangle the package via PR.
I changed
session.sessionPasswordResponse
to be exported then created an alternate session.Open function that would accept it in and create a Session without trying to login. Staying compatible with the current Session interface so I could pass my session to your systems.I don't think this solution is very clean because it still requires a sfdc.Configuration object with all the OAuth properties.
The text was updated successfully, but these errors were encountered: