You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi not an issue as such but has anyone used this gem and saved token in memory rather than local storage/cookies in rails? Is there a way of doing that?
Thanks
The text was updated successfully, but these errors were encountered:
Think this gem is not really related to storing tokens. But one way to store tokens in memory would be to have a class variable as storage. This approach is probably only suitable if the tokens are specific for the application and is not that dynamic, like depending on the user of the application.
module MyMemoryTokenCache
def self.cached_token
@cached_token = nil if @cached_token.expired?
@cached_token ||= fetch_token
end
def self.fetch_token
# Generate/fetch the token from 3rd party
end
end
On 18/08/2021, Joakim Antman ***@***.***> wrote:
Think this gem is not really related to storing tokens. But one way to store
tokens in memory would be to have a class variable as storage. This approach
is probably only suitable if the tokens are specific for the application and
is not that dynamic, like depending on the user of the application.
```
module MyMemoryTokenCache
def self.cached_token
@cached_token = nil if @cached_token.expired?
@cached_token ||= fetch_token
end
def self.fetch_token
# Generate/fetch the token from 3rd party
end
end
```
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#436 (comment)
Hi not an issue as such but has anyone used this gem and saved token in memory rather than local storage/cookies in rails? Is there a way of doing that?
Thanks
The text was updated successfully, but these errors were encountered: