-
Notifications
You must be signed in to change notification settings - Fork 41
developers import
CardMaker layouts are driven by data. Even if there is no reference associated at least one entry is created.
As of this writing the Deck
class triggers the request to load a reference.
This is easy! Deck.ProcessLines
simply adds a single line. As of this writing the code for this is
no seperated out like the other import types (and probably should be).
Using the CSVFile
class lines are read from the file. There are some hacks to attempt to work around
file locking that arises if the user operates with an editor that locks the CSV file.
Google spreadsheets are referenced using a special string that indicates the name of the spreadsheet and subsheet to pull data from.
Google does not offer an OAUTH2 option that streamlines things like renewing tokens for previously authorized CardMaker users.
As of this writing the token timeout is 1 hour. After this the application must go through the authentication process again.
Currently the model being followed is detailed here: https://developers.google.com/identity/protocols/OAuth2UserAgent
OAUTH2 tokens can be configured here: https://console.developers.google.com
Basically the steps are as follows:
- (in CardMaker) User is shown the Google Credentials prompt and selects Browse To URL
- This request hits a php page (cardmaker_oauth2_v2_request.php) on my site that forwards the browser to Google
- The user has to authorize CardMaker to access Google Spreadsheets (Google webpage)
- Google then forwards the browser to my site on a landing page (cardmaker_oauth2_v2_callback.php) that processes the navigation (and fragment data) and presents a token
- The token has to be copied back into CardMaker for use when accessing Spreadsheets
This is the best alternative to embedding the private key in the application (terrible idea, open source or not) OR running my own backend sql server to keep track of user tokens (also a terrible idea).
In addition to importing the main reference file each importer supports pulling in the project wide and layout specific define references.