Class: Google::Auth::Stores::DbTokenStore
- Inherits:
-
TokenStore
- Object
- TokenStore
- Google::Auth::Stores::DbTokenStore
- Defined in:
- app/models/google/auth/store/db_token_store.rb
Instance Method Summary collapse
Instance Method Details
#delete(id) ⇒ Object
30 31 32 33 |
# File 'app/models/google/auth/store/db_token_store.rb', line 30 def delete id credentials = User.find_by(auth_id: id) credentials.destroy end |
#load(id) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/google/auth/store/db_token_store.rb', line 8 def load id credentials = Comfy::Admin::Meetalendar::AuthCredential.find_by(auth_id: id) !credentials.nil? ? { # NOTE(Schau): The encryption algorithm must decipher the encrypted tokens! It does so in this function call: credentials.access_token and credentials.refresh_token auth_id: credentials.auth_id, client_id: credentials.client_id, access_token: credentials.access_token, refresh_token: credentials.refresh_token, scope: credentials.scope, expiration_time_millis: credentials.expiration_time_millis }.to_json.to_s : nil end |
#store(id, token) ⇒ Object
24 25 26 27 |
# File 'app/models/google/auth/store/db_token_store.rb', line 24 def store id, token token_hash = JSON.parse(token).symbolize_keys Comfy::Admin::Meetalendar::AuthCredential.find_or_initialize_by(auth_id: id).update(token_hash) end |