Closed alichtman closed 6 years ago
Also promising: https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow
Must initiate a redirect to an endpoint which will display the login dialog:
https://www.facebook.com/v2.12/dialog/oauth?
client_id={app-id}
&redirect_uri={redirect-uri}
&state={state-param}
This endpoint has required parameters:
If your login request looks like:
https://www.facebook.com/v2.12/dialog/oauth?
client_id={app-id}
&redirect_uri={"https://www.domain.com/login"}
&state={"{st=state123abc,ds=123456789}"}
then your redirect URI would be called with:
https://www.domain.com/login?state="{st=state123abc,ds=123456789}"
Add public_profile
permission and pull FB id from id
property of it.
So, we need to add a "Login with Facebook" button to popup.html
that's displayed when a user first installs the app. That button should link to this. Then, we need to write a function in background.js
to handle the redirect URI (which should return success and an access token). That function should store the access token in localStorage, refresh Messenger, and load the graph in popup.html
.
This guy figured it out: https://github.com/ALiangLiang/Counter-for-Messenger
I've never been so happy to tag something wontfix
before.
No point in designing a secure registration system only to switch to FB auth later.
^^ This looks promising, maybe. @shobrook, read step 3 and lmk if this is applicable. I understand Step 1, but I don't know where the rest of the code goes.
~This is used to get Oauth2 keys. Need to add "identity" permission in
manifest.json
~~We could do Google Auth pretty easily, but it makes a ton more sense to do FB auth. It's a pain, but...~