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
Salesforce Developer 60Salesforce Developer 60 

How to Store session access token into cookie

Hi,
  I am new to Salesforce API. Currently i am working on calling .net rest api into salesforce. I am able to hit the url and get access token in developer console but now i want to store this into cookie for use in future call. Any sample code for consume .net Api into saleforce using store access token into cookies? I already register api url into remote setting , I have doubt should i register it into connected app also?

Thanks
NagaNaga (Salesforce Developers) 
Hi Salesforce Developer,

The client can handle this by having some logic for handling a request to the Salesforce API which fails with an Unauthorized response. When an Unauthorized response is received the client can ask your web server for a new access token / session id.

Alternatively you'd have to use WebSockets or some push technology to push the new access token to the client when the web server refreshes the token.

Best Regards
Naga Kiran
Salesforce Developer 60Salesforce Developer 60
Thanks for quick response. But i want to know how to store access token in Salesforce for future use either in cookie or some where else.
Mudmayee Chaturvedi 8Mudmayee Chaturvedi 8
Hi 
Any solution insights? I can't seem to figure out a way except creating a custom object to store tokens (when token length is 2000 characters)

Thanks