Sha256: 9b83901b2d83395b69d0575fa3ce496084d7a4777df2da3425c04dc8c6f93914
Contents?: true
Size: 1.29 KB
Versions: 5
Compression:
Stored size: 1.29 KB
Contents
require "googleauth/token_store" module Google module Auth module Stores class DbTokenStore < Google::Auth::TokenStore # (see Google::Auth::Stores::TokenStore#load) 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 # (see Google::Auth::Stores::TokenStore#store) 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 # (see Google::Auth::Stores::TokenStore#delete) def delete id credentials = User.find_by(auth_id: id) credentials.destroy end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems