Skip to content

Commit

Permalink
Fix caching problem with new FOLIO auth scheme (#113)
Browse files Browse the repository at this point in the history
* DACCESS-261: Rely on new version of cul-folio-edge (#109)

* FOLIO token changes, authenticate returns a token expiration

* Require latest version of cul_folio_edge; remove borrow_direct dependency (DACCESS-261)

* Formatting

* Remove 'newcatalog' references

* Remove 'newcatalog' references

---------

Co-authored-by: Melissa Wallace <[email protected]>
Co-authored-by: Sarah Chintomby <[email protected]>

* v2.3.1 - Fix bug in gemspec specification

* Fix caching problem with new FOLIO auth scheme (#112)

---------

Co-authored-by: Melissa Wallace <[email protected]>
Co-authored-by: Sarah Chintomby <[email protected]>
  • Loading branch information
3 people authored Aug 26, 2024
1 parent 84a1745 commit 91e2c3d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/controllers/my_account/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ def index

# Return a FOLIO authentication token for API calls -- either from the session if a token
# was previously created, or has expired, or directly from FOLIO otherwise.
#
# TODO: Caching is being disabled for now, since it's causing problems with the new expiring
# token mechanism in FOLIO. We need to figure out how to cache the token properly. (mjc12)
def folio_token
if session[:folio_token].nil? || (session[:folio_token_exp].present? && Time.now > Time.parse(session[:folio_token_exp]))
# if session[:folio_token].nil? || (session[:folio_token_exp].present? && Time.now > Time.parse(session[:folio_token_exp]))
url = ENV['OKAPI_URL']
tenant = ENV['OKAPI_TENANT']
response = CUL::FOLIO::Edge.authenticate(url, tenant, ENV['OKAPI_USER'], ENV['OKAPI_PW'])
Expand All @@ -74,7 +77,7 @@ def folio_token
session[:folio_token] = response[:token]
session[:folio_token_exp] = response[:token_exp]
end
end
# end
session[:folio_token]
end

Expand Down
2 changes: 1 addition & 1 deletion lib/my_account/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MyAccount
VERSION = '2.3.1'
VERSION = '2.3.2'
end
5 changes: 5 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Release Notes - my-account

## [2.3.2] - 2024-08-26

### Fixed
- New FOLIO token auth scheme causing problems because of token caching; caching disabled for now

## [2.3.1] - 2024-08-20

### Fixed
Expand Down

0 comments on commit 91e2c3d

Please sign in to comment.