Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook Login #19

Open
Felli opened this issue May 8, 2017 · 12 comments
Open

Facebook Login #19

Felli opened this issue May 8, 2017 · 12 comments

Comments

@Felli
Copy link
Contributor

Felli commented May 8, 2017

I believe something like this could help fix this issue. 👍

@chamathpali
Copy link
Member

That seems an old post i guess

@Felli
Copy link
Contributor Author

Felli commented May 8, 2017

Should still work how it is supposed to, I'll try to implement this later today if that is cool?

Felli added a commit to Felli/flarum-mobile-android that referenced this issue May 8, 2017
@chamathpali
Copy link
Member

@Felli Yes sure. That would be great 👍

@punitcodes
Copy link
Contributor

Since our App is not native, Facebook SDK won't help. Can you please try this

@Felli
Copy link
Contributor Author

Felli commented May 13, 2017

@punit2502 that is simple enough, I'll also do some test runs of this. 👍

@chamathpali
Copy link
Member

How is the progress on this @Felli any luck? 😃

@Felli
Copy link
Contributor Author

Felli commented May 21, 2017

Sadly no, I've not had the time as of yet to complete this, although I'll try to get this done by next weekend if possible.

@duman
Copy link

duman commented Jun 25, 2017

@chamathpali @Felli I found something.
Due to Facebook using popup to login, webview gets a bit confused. Anyway, after you use Facebook to login there's a white page. Right? Now reload the page at that white page. 500 internal server erroe will come. Close the app and reopen it, you're logged in.

That may give some ideas. (Also white page URL is: "yourwebsite.tld/auth/facebook?code=fbauthCode")

For now, I just added:

public boolean     shouldOverrideUrlLoading(WebView view, String url) {
        String url3="https://m.facebook.com/";
        String url2="https://www.facebook.com/";
        // Above URLs should be improved because currently ANY Facebook link is considered as Facebook login attempt. Will fix it tomorrow.
        if (url.startsWith(url3) || url.startsWith(url2)).    {
            webView.loadUrl("A hidden static sorry Android Facebook login isn't currently available page link on your site") // can be avhieved by pages plugin
            return true;
            }  else  {
            return false;
            }
    }

And, here's how it looks in app. (When you press the Facebook login button.)
how it looks

@Felli
Copy link
Contributor Author

Felli commented Jun 25, 2017

@dumanpro something similar to this here should be possible when dealing with the popup issue for Facebook login, there is also this here to take into consideration. 👍

@duman
Copy link

duman commented Jun 25, 2017

@Felli disabling popups would just make it do nothing? Here's how Facebook works. You press the "login with fb" button. A new window opens. You enter your information. Allow using that app. The final link in that popup window is a flarum link. Which is example.com/auth/facebook?... at that window auth completes and popup closes. The window below now saved this via cookie manager and knows that you're logged in.

What we need is detecting a popup, and adding to onPageFinish, something like

url.startsWith("https://flarum.org/auth/facebook?") {
webView.loadUrl("https://flarum.org");
}

I've tried this but there's a small problem. You can login Facebook. After window, you do get redirected to your flarum site, BUT, you're not signed in.

There's a way to sign in as I mentioned above but it's broken. Remember me adding swipe down to reload? Now step by step to login:

  1. Open app, and login via Facebook.
  2. At the white blank window (which is actually your site ./auth/facebook?...) swipe down to refresh.
  3. Get a 500 Internal Server Error.
  4. Close app via app manager. (Square button)
  5. Re open. You're now logged in with your Facebook account.

What I'm thinking is:
There are some mobile games with Facebook login option. When you try to login with them they popup a new window, an actual popup with an X button on top left. If we can run Facebook on an external page like that, that'll be it.

I'll try to solve it now. If I can I will release a version with swipe down refresh + working Facebook login. (working anything popup login)

@Felli
Copy link
Contributor Author

Felli commented Jun 25, 2017

I myself am testing out this method here at the moment, and have a apk file created and waiting for testing, the only issue I'm having is creating a key hash for Facebook.

@chamathpali
Copy link
Member

Facebook login is a crucial part we need to solve in the mobile apps. 😞 lets try to get some work around soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants