Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Session Token with REST

MikeMeilleur
Collaborator III

Using REST, is there a way to get a user's session token without attempting to login again?  Using the Login endpoint resets the session token.  I was wondering if there's a way to get the current token as we are running into session collisions.

1 ACCEPTED SOLUTION

Accepted Solutions

BodieMinster
Archer Employee
Archer Employee

You can get the current user's session token from their UI session using JavaScript in a custom object. You can then pass that session token to your integration code for use by the REST API.

 

There is no way to get a session from the API without providing credentials. To allow that would be to provide a back door that bypasses all existing security, so I would not expect that feature to be coming to the platform.

View solution in original post

4 REPLIES 4

Ilya_Khen
Champion III

Mike Meilleur,

 

Once you authenticated once, you should store this session and use it. 

You can get session ID from the DB directly, but did not see that functionality in REST API currently.

BodieMinster
Archer Employee
Archer Employee

You can get the current user's session token from their UI session using JavaScript in a custom object. You can then pass that session token to your integration code for use by the REST API.

 

There is no way to get a session from the API without providing credentials. To allow that would be to provide a back door that bypasses all existing security, so I would not expect that feature to be coming to the platform.

This makes sense.  But what I was hoping for was a way to perhaps pass the credentials to get the current session token back and not get a new one.  Basically, use the login functionality but if there is already a session token, return it instead of getting a brand new one.  This was session collisions wouldn't occur.

 

What Ilya Khen‌ mentions above would work but that session token would have to be saved somewhere.  When rapid-firing multiple requests from multiple threads, it would be easier if the token would simply stay the same using the same login process.  But I do understand why it is not.

I see what you're saying. And I like the idea. Have you submitted it as a suggestion?