Slaesforce FAQ

how often do salesforce refresh tokens expire

by Miss Janice Powlowski DDS Published 2 years ago Updated 2 years ago
image

Refresh tokens will expire X days (or hours) after their creation. Depending on your security requirements this expiration will be 1 month or 1 hour. You have to make the decision taking care some aspects as functionality and security.

The refresh token is used indefinitely, unless revoked by the user or Salesforce admin.

Full Answer

How long does a Salesforce access token last?

In our experience at Xkit, Salesforce Access Tokens typically expire in 2 hours (7,200 seconds), but this value is not guaranteed to be static—Salesforce could change it at any time with no warning. So what do you do? You have two options:

Do refresh tokens expire?

Refresh tokens may or may not have expiry time, depending on your provider they expire never, not as long as they're recently used, in months or in hours. Relying on the fact that you will receive new refresh token with refreshed access token may be tricky. Timeout is not the only way in which token may become invalid.

What is expires_in in Salesforce OAuth?

According to the OAuth 2.0 spec the expires_in parameter is included with the Access Token response and provides the lifetime of the returned token in seconds. And while this parameter is extremely common in OAuth implementations, it is merely recommended and not required. The Salesforce OAuth implementation does not use this parameter.

How do I use refresh tokens for session authentication?

If you use refresh tokens, your code should first try the regular API call, and if you get a 4xx result, try using the refresh token to get a new session token, and if that fails, then you've been kicked out, and the user needs to re-authenticate to continue. If you don't use refresh tokens, you can skip the middle step, obviously

image

How long do refresh tokens last?

The refresh token is set with a very long expiration time of 200 days. If the traffic to this API is 10 requests/second, then it can generate as many as 864,000 tokens in a day.

Are refresh tokens permanent?

The Google Auth server issued Refresh tokens never expire — that's the whole point of the refresh tokens. The refresh token will expire (or I should say become unauthorized) when the user revokes access to your application.

How do I know if my refresh token is expired?

If you look in the dashboard application settings, you can see the Refresh Token expiration time. By default, it is 720 hours (2592000 seconds).

How many times can a refresh token be used?

A Refresh Token is valid for 60 days and can be used to obtain a new Access Token and Refresh Token only once. If the Access Token and Refresh Token are not refreshed within 60 days, the user will need to be re-authorized.

Does token expire?

As mentioned, for security purposes, access tokens may be valid for a short amount of time. Once they expire, client applications can use a refresh token to "refresh" the access token.

What happens if refresh token is stolen?

Because the token is used to identify the client, if one is stolen or compromised, an attacker has full access to the user's account in the same way they would if the attacker had instead compromised the user's username and password. Refresh tokens are long-lived.

How increase token expire time?

Update Access Token LifetimeGo to Dashboard > Applications > APIs and click the name of the API to view.Locate the Token Expiration (Seconds) field, and enter the appropriate access token lifetime (in seconds) for the API. Default value is 86,400 seconds (24 hours). ... Click Save Changes.

How do I refresh a salesforce token?

Request an Updated Access Token. A connected app can use the refresh token to get a new access token by sending one of the following refresh token POST requests to the Salesforce token endpoint. The connected app can send the client_id and client_secret in the body of the refresh token POST request, as shown here.

Can a refresh token be used multiple times?

However I recently noticed that I can re-use a refresh-token multiple times and issue a new access token successfully. Based on my experiment the refresh-token is valid as long as I don't use the one that is returned in the API response.

Should you store refresh tokens?

The client needs to store the refresh token safely. A malicious attacker gets access to the refresh and access token and uses it to request protected data to the resource server. The malicious attacker can get protected data from the resource server.

What is sliding refresh token lifetime?

Sliding: when refreshing the token, the lifetime of the refresh token will be renewed (by the amount specified in SlidingRefreshTokenLifetime). The lifetime will not exceed the absolute lifetime.

How long does a refresh token last?

Does this mean that the refresh_token will be indefinitely valid or does it expire: 1 X days after being issued; or 2 X days after the last use of it for obtaining a new access_token

Why is my refresh token no longer valid?

Some of the reasons a refresh token may no longer be valid include: the authorization server has revoked the refresh token. the user has revoked their consent for authorization. the refresh token has expired.

What is refresh token?

Refresh tokens are issued to the client by the authorization server and are used to obtain a new access token when the current access token becomes invalid or expires, or to obtain additional access tokens with identical or narrower scope (access tokens may have a shorter lifetime and fewer permissions than authorized by the resource owner)

How long does a security expiration last?

Depending on your security requirements this expiration will be 1 month or 1 hour. You have to make the decision taking care some aspects as functionality and security. If you decide to priorize security, a short expiration could make your application anoying for the user.

Do refresh tokens expire?

Refresh tokens may or may not have expiry time, depending on your provider they expire never, not as long as they're recently used, in months or in hours. Relying on the fact that you will receive new refresh token with refreshed access token may be tricky.

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9