function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
J. Scott CromieJ. Scott Cromie 

Federated SSO using jsForce

Federated SSO using jsForce
Hi everyone,

I'm currently trying to set up jsForce to connect to SFDC using a Federated Id.  The client has enabled SSO, and I am able to get an assertion from their identity server, but I am not sure how to use jsForce to get a token from Salesforce and then get the session id.

I have tried using Postman to set up the POST call with the assertion, like so:

POST /services/oauth2/token?so=00Dm00000008fCJ HTTP/1.1
Host: <mysandbox>.cs20.my.salesforce.com
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW
Cache-Control: no-cache
Postman-Token: d8e0ad17-37ae-35a1-4207-d95b562d954d

------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="assertion"

PHNhbWxwOlJlc3BvbnNlIHhtbG5zOnNhbWxwPSJ1cm46b2FzaXM6bmFtZXM6dGM6%0D%0AU0FNTDoyLjA6cHJvdG9jb2wiIHhtbG5zOmRzaWc9Imh0dHA6Ly93d3cudzMub3Jn%0D%0ALzIwMDAvMDkveG1sZHNp<clipped for brevity>3D%0D%0A
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="grant_type"

urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Asaml2-bearer
------WebKitFormBoundary7MA4YWxkTrZu0gW
Content-Disposition: form-data; name="RelayState"

%2F
------WebKitFormBoundary7MA4YWxkTrZu0gW--


I'm using the saml2-bearer grant type as specified within the docs (https://help.salesforce.com/apex/HTViewHelpDoc?id=remoteaccess_oauth_SAML_bearer_flow.htm&language=en_US) but I still get the following response:  

{
  "error": "unsupported_grant_type",
  "error_description": "grant type not supported"
}

Does anyone know where I need to go to suss out the root cause of this?

Thanks in advance for your help.