Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UserInfo.getSessionId() makes this unusable in packaged code #290

Open
mfrenchlitify opened this issue Dec 16, 2022 · 2 comments
Open

UserInfo.getSessionId() makes this unusable in packaged code #290

mfrenchlitify opened this issue Dec 16, 2022 · 2 comments

Comments

@mfrenchlitify
Copy link

Salesforce recently decided that any usage of UserInfo.getSessionId(); will be an automatic failure of security review for managed packages. This wrapper uses this function in MetadataDeployController.cls, so this wrapper is no longer usable by managed packages.

@m0rjc
Copy link

m0rjc commented Jul 31, 2023

I understand that getSessionId() is OK for read access. I'm trying to remember the situation for very limited write access (to data that the package is considered to own like its own SObjects, Fields, Pages....).

It would be something to work out with Security Review.

This thread on Stack Exchange is interesting. https://salesforce.stackexchange.com/questions/389121/call-salesforce-api-from-apex-and-not-fail-security-review

@m0rjc
Copy link

m0rjc commented Jul 31, 2023

Looking through the sample code, it seems easy to adapt this to work with a Connected App solution. For example

service.SessionHeader.sessionId = UserInfo.getSessionId();
shows calling code specifying a session ID.

Salesforce have published a JWT Signed Token solution for Connected Apps. Not my favourite solution. Certinia have published a proof of concept for a Web Flow solution (https://github.com/certinia/mdapi-oauth-demo). There's a variation of the JWT solution there too. These correspond to the solutions mentioned in the Stack Exchange thread I linked to earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants