You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
Current flow
Right now, the authentication and sign up for notifications flow is quite complicated. There are two parts to it:
If the user does not have a valid loginKey in the frontend:
the user clicks the Facebook sign in button on a class and a loginKey is created
a request goes to facebook’s servers with a data-ref that includes the class/section they clicked
a request goes from the frontend to the backend asking for the latest user data
Facebook sends a webhook to the server with authentication verification and the data-ref
The backend matches the request from the frontend and the webhook from facebook
The backend signs the user up for classes and sends the latest user data to frontend
The frontend’s loginKey is now trusted and this flow doesn’t have to happen again.
This odd process has to happen because we need to trust the user before signing them up for notifications. We get this trust from the Facebook webhook, so we need to wait for that before trusting the loginKey the frontend generated.
If the user has a valid loginKey in the frontend:
The frontend makes a request to /addSection, /removeSection, or /addClass with loginKey
loginKey is found in DB and DB is updated
Future Flow
What we should be able to change to (regardless of whether the user has logged in before or not):
Call FB.login() or FB.getLoginStatus() to get a FB signed token
FB will make a popup appear if the user hasen’t signed in before
Frontend makes requests to /addSection (etc. ) endpoints with signed FB token
Backend verifies the token and trusts the user and updates DB
When we make this refactor, we can delete all of function onSendToMessengerButtonClick and function cleanOldReqs in server.js and the entire opt_in branch at the bottom of facebook.js.
The text was updated successfully, but these errors were encountered:
Current flow
Right now, the authentication and sign up for notifications flow is quite complicated. There are two parts to it:
If the user does not have a valid loginKey in the frontend:
The frontend’s loginKey is now trusted and this flow doesn’t have to happen again.
This odd process has to happen because we need to trust the user before signing them up for notifications. We get this trust from the Facebook webhook, so we need to wait for that before trusting the loginKey the frontend generated.
If the user has a valid loginKey in the frontend:
Future Flow
What we should be able to change to (regardless of whether the user has logged in before or not):
When we make this refactor, we can delete all of
function onSendToMessengerButtonClick
andfunction cleanOldReqs
in server.js and the entireopt_in
branch at the bottom of facebook.js.The text was updated successfully, but these errors were encountered: