Web micro-service allowing users to authenticate via osu! before being redirected to Google Forms with pre-filled authentication fields.
forked from https://git.cartooncraft.fr/osufrlive/form-auth
Try it out at: https://form-auth.osufr.live/form/example
Results can be seen at: https://docs.google.com/spreadsheets/d/1-ybVd_CzYZMfM8dau2CNBGso06fE407o0xalCT_nDpw/edit
Clone the project, then install dependencies: npm install
.
Build the project: npm run build
.
Copy config/default.json
to config/user/$USER.json
and fill in the values:
- http.url is deployment public url; eg. https://form-auth.osufr.live
- secret.cookies is any random string
- secret.{tokensPrivateKey,tokensPublicKey} can be generated using
npx ts-node src/genKeys.ts
) - osu.{clientId,clientSecret} can be created in osu! account settings (set redirect URL to
${http.url}/auth/osu/callback
) - forms:
- name will be used as the form name in authentication URL:
${http.url}/form/${name}
- url is the Google Form
viewform
URL - field IDs can be obtained by generating a "pre-filled link" in Google Forms, filling in random data in each fields, and getting the IDs from the result URL.
- name will be used as the form name in authentication URL:
Run the service using npm start
.
Clone the project, copy config/default.json
to config/deployment/production.json
and fill in the values (see above). Note that some variables can be omitted and provided via environment variables instead (see config/env/production.json
).
Clone the project, copy the variables you want to change from form-auth-chart/values.yaml
to values.yaml
, and run: helm upgrade --install --create-namespace --namespace form-auth form-auth form-auth-chart -f ./values.yaml
In your Google Forms answer sheet, open Google Apps Script and add the following code:
function verify(formName, signature, timestamp, id, username) {
return UrlFetchApp.fetch(`https://${http.url}/form/${formName}/verify`, {
contentType: "application/json",
payload: JSON.stringify({
signature,
timestamp,
id,
username,
}),
}).getContentText();
}
Replace ${http.url}
by your deployment URL.
Add a "verification" column and fill it with the following formula:
=VERIFY("example",E2,F2,C2,D2)
E2 being the signature cell, F2 the timestamp cell, C2 the osu! user ID cell, D2 the osu! username cell.