microg / GmsCore

Free implementation of Play Services
https://microg.org
Apache License 2.0
8.53k stars 1.72k forks source link

Login fails with Microsoft Google Apps account #28

Closed jamorford closed 9 years ago

jamorford commented 9 years ago

I cannot login with my Microsoft Google apps account created by a school district. After trying to login, the app gets stuck with "Just a sec..." and "One moment please..." on the screen. Here is what happens when I try to login:

1) Add a Google Account 2) I type in the email address and click Next 3) Google says it is managed by a 3rd party, and I click Accept 4) Microsoft login page appears, and I login 5) "Just a sec..." reappears 6) After a few more seconds, "One moment please" appears 7) The app hangs on this screen indefinitely

Here is a screenshot:

There does not appear to be an error in the logcat

jamorford commented 9 years ago

Here is what happens if I click the back button twice quickly. It looks like it is a transparent WebView or iframe overlay is in use to show the "One moment please..."

I have some experience with Android, Java, and web, so I'd be willing to help fix this issue if I could get some direction of how the login process works in general. I haven't studied how this app or the Google apps function yet.

jamorford commented 9 years ago

I was able to capture a logcat and some additional information. The "One moment please..." screen is where Google is trying to issue an oauth2 token after authenticating with a 3rd party (in this case, Microsoft). Here is a screenshot from a desktop browser and the URL for the page. The same URL is the last one that appears in the logcat.

https://accounts.google.com/o/oauth2/programmatic_auth?cc&return_user_id=true&tmpl=new_account&langCountry=en_&xoauth_display_name=Android+Device&source=android&lang=en&client_id=[snip].apps.googleusercontent.com&scope=https://www.google.com/accounts/OAuthLogin&access_type=offline&set_oauth_token_cookie=true&hl=en_

Here is the full login trace from Firebug: capture2

Here are the request and response headers for the last page: capture3 capture4

Here is the (filtered) logcat during my login attempt:

Search "GMS" (77 hits in 1 file)
  new 1 (77 hits)
    Line 276: I/ActivityManager(  830): START u0 {cmp=com.google.android.gms/org.microg.gms.auth.login.LoginActivity (has extras)} from uid 1000 on display 0
    Line 276: I/ActivityManager(  830): START u0 {cmp=com.google.android.gms/org.microg.gms.auth.login.LoginActivity (has extras)} from uid 1000 on display 0
    Line 278: V/WindowManager(  830): addAppToken: AppWindowToken{352a1303 token=Token{1cafe7b2 ActivityRecord{333075bd u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1195}}} to stack=1 task=1195 at 4
    Line 278: V/WindowManager(  830): addAppToken: AppWindowToken{352a1303 token=Token{1cafe7b2 ActivityRecord{333075bd u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1195}}} to stack=1 task=1195 at 4
    Line 284: V/WindowManager(  830): Adding window Window{3f73b0b9 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity} at 9 of 18 (after Window{11c86349 u0 com.android.settings/com.android.settings.accounts.ChooseAccountActivity})
    Line 284: V/WindowManager(  830): Adding window Window{3f73b0b9 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity} at 9 of 18 (after Window{11c86349 u0 com.android.settings/com.android.settings.accounts.ChooseAccountActivity})
    Line 285: I/ActivityManager(  830): Displayed com.google.android.gms/org.microg.gms.auth.login.LoginActivity: +320ms
    Line 285: I/ActivityManager(  830): Displayed com.google.android.gms/org.microg.gms.auth.login.LoginActivity: +320ms
    Line 289: I/Timeline(  830): Timeline: Activity_windows_visible id: ActivityRecord{333075bd u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1195} time:1461627
    Line 289: I/Timeline(  830): Timeline: Activity_windows_visible id: ActivityRecord{333075bd u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1195} time:1461627
    Line 292: D/GmsAuthLoginBrowser( 1467): pageFinished: https://accounts.google.com/EmbeddedSetup?source=android&xoauth_display_name=Android%20Device&lang=en&cc=us&langCountry=en_us&hl=en-US&tmpl=new_account
    Line 294: D/GmsAuthLoginBrowser( 1467): pageFinished: https://accounts.google.com/EmbeddedSetup?source=android&xoauth_display_name=Android%20Device&lang=en&cc=us&langCountry=en_us&hl=en-US&tmpl=new_account#identifier
    Line 295: D/GmsAuthLoginBrowser( 1467): Terms of service accepted. (who cares?)
    Line 296: D/GmsAuthLoginBrowser( 1467): JSBridge: showView
    Line 360: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 360: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 360: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 360: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 361: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 387: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 387: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 387: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 387: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 388: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 447: I/Timeline(  830): Timeline: Activity_windows_visible id: ActivityRecord{333075bd u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1195} time:1511506
    Line 447: I/Timeline(  830): Timeline: Activity_windows_visible id: ActivityRecord{333075bd u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1195} time:1511506
    Line 718: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 718: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 718: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 718: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 719: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 1224: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1224: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1224: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1224: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1225: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 1247: I/ActivityManager(  830): START u0 {cmp=com.google.android.gms/org.microg.gms.auth.login.LoginActivity (has extras)} from uid 1000 on display 0
    Line 1247: I/ActivityManager(  830): START u0 {cmp=com.google.android.gms/org.microg.gms.auth.login.LoginActivity (has extras)} from uid 1000 on display 0
    Line 1249: V/WindowManager(  830): addAppToken: AppWindowToken{1c751364 token=Token{2ab918f7 ActivityRecord{2de83cf6 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1197}}} to stack=1 task=1197 at 4
    Line 1249: V/WindowManager(  830): addAppToken: AppWindowToken{1c751364 token=Token{2ab918f7 ActivityRecord{2de83cf6 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1197}}} to stack=1 task=1197 at 4
    Line 1255: V/WindowManager(  830): Adding window Window{3ad33282 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity} at 7 of 15 (after Window{2a10f0d2 u0 com.android.settings/com.android.settings.accounts.ChooseAccountActivity})
    Line 1255: V/WindowManager(  830): Adding window Window{3ad33282 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity} at 7 of 15 (after Window{2a10f0d2 u0 com.android.settings/com.android.settings.accounts.ChooseAccountActivity})
    Line 1256: I/ActivityManager(  830): Displayed com.google.android.gms/org.microg.gms.auth.login.LoginActivity: +429ms
    Line 1256: I/ActivityManager(  830): Displayed com.google.android.gms/org.microg.gms.auth.login.LoginActivity: +429ms
    Line 1260: I/Timeline(  830): Timeline: Activity_windows_visible id: ActivityRecord{2de83cf6 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1197} time:1628668
    Line 1260: I/Timeline(  830): Timeline: Activity_windows_visible id: ActivityRecord{2de83cf6 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity t1197} time:1628668
    Line 1261: D/GmsAuthLoginBrowser( 1467): pageFinished: https://accounts.google.com/EmbeddedSetup?source=android&xoauth_display_name=Android%20Device&lang=en&cc=us&langCountry=en_us&hl=en-US&tmpl=new_account
    Line 1263: D/GmsAuthLoginBrowser( 1467): pageFinished: https://accounts.google.com/EmbeddedSetup?source=android&xoauth_display_name=Android%20Device&lang=en&cc=us&langCountry=en_us&hl=en-US&tmpl=new_account#identifier
    Line 1264: D/GmsAuthLoginBrowser( 1467): Terms of service accepted. (who cares?)
    Line 1282: D/GmsAuthLoginBrowser( 1467): JSBridge: showView
    Line 1489: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1489: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1489: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1489: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1490: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 1776: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1776: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1776: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1776: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1777: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 1941: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1941: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1941: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1941: D/GmsGcmMcsSvc( 1467): Heartbeat initiated, reason: Intent { act=org.microg.gms.gcm.mcs.HEARTBEAT flg=0x4 cmp=com.google.android.gms/org.microg.gms.gcm.McsService (has extras) }
    Line 1942: D/GmsGcmMcsSvc( 1467): Outgoing message: HeartbeatPing{}
    Line 1958: V/WindowManager(  830): Adding window Window{7740bcb u0 PopupWindow:2fbcf773} at 7 of 15 (after Window{3ad33282 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity})
    Line 1958: V/WindowManager(  830): Adding window Window{7740bcb u0 PopupWindow:2fbcf773} at 7 of 15 (after Window{3ad33282 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity})
    Line 1959: D/GmsAuthLoginBrowser( 1467): JSBridge: hideKeyboard
    Line 1960: D/GmsAuthLoginBrowser( 1467): JSBridge: getDroidGuardResult: ["[snip (user name here]>AEThLlxrktosiSmG3YwJmb_k3ToMnFkRn1Zx2QSr9cqYAlljhz73BSUZtL_TFw"]
    Line 1962: D/GmsAuthLoginBrowser( 1467): pageFinished: https://accounts.google.com/EmbeddedSetup?source=android&xoauth_display_name=Android%20Device&lang=en&cc=us&langCountry=en_us&hl=en-US&tmpl=new_account#tostosamlredirect
    Line 1963: D/GmsAuthLoginBrowser( 1467): JSBridge: showView
    Line 2017: D/GmsAuthLoginBrowser( 1467): pageFinished: https://login.microsoftonline.com/9360c11f-90e6-4706-ad00-25fcdc9e2ed1/saml2?SAMLRequest=jVLJTsMwEL0j8Q%2BR79mQisBqggoIUYklagMHbq4zSR0cT%2FA4Lfw9bgoCDiCuz8%2Fzlpnp2Wungw1YUmgylkYJC8BIrJRpMvZQXoUn7Cw%2FPJiS6HTPZ4NbmwW8DEAu8D8N8fEhY4M1HAUp4kZ0QNxJvpzd3vCjKOG9RYcSNQvmlxlDxFboTtcS2m7VS4VaVm29em7rpu9B1bjWpoGKBY%2Bfto52tuZEA8wNOWGch5J0EqZJmEzK9JQnxzydPLGg%2BFA6V2af4C9bqz2J%2BHVZFmFxvyzHARtVgb3z7Iw1iI2GSGK3ky8Ekdp4uBaagAUzIrDOG7xAQ0MHdgl2oyQ8LG4ytnauJx7H2%2B02%2BhoTi7gF8pUpA9HzG8k1oqZooFhIYvnYMh%2BD2m%2F1%2Fh1DfNpg%2BT%2BEpvE3jfxjrbu088sCtZJvwUxr3F5YEM5HdXbwSa%2FQdsL9biON0hFRVViPVD4Y6kGqWu32GOd71Z%2F346%2FqHQ%3D%3D&RelayState=https%3A%2F%2Faccounts.google.com%2FCheckCookie%3Fcontinue%3Dhttps%253A%252F%252Faccounts.google.com%252Fo%252Fandroid%252Fauth%253Flang%253Den%2526cc%2526langCountry%253Den_%2526xoauth_display_name%253DAndroid%252BDevice%2526source%253Dandroid%2526tmpl%253Dnew_account%2526return_user_id%253Dtrue
    Line 2177: V/WindowManager(  830): Adding window Window{37f72484 u0 PopupWindow:2fbcf773} at 7 of 15 (after Window{3ad33282 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity})
    Line 2177: V/WindowManager(  830): Adding window Window{37f72484 u0 PopupWindow:2fbcf773} at 7 of 15 (after Window{3ad33282 u0 com.google.android.gms/org.microg.gms.auth.login.LoginActivity})
    Line 2179: D/GmsAuthLoginBrowser( 1467): pageFinished: https://login.microsoftonline.com/9360c11f-90e6-4706-ad00-25fcdc9e2ed1/login
    Line 2199: D/GmsAuthLoginBrowser( 1467): pageFinished: https://www.google.com/a/jessamine.kyschools.us/acs
    Line 2204: D/GmsAuthLoginBrowser( 1467): pageFinished: https://accounts.google.com/o/oauth2/programmatic_auth?cc&return_user_id=true&tmpl=new_account&langCountry=en_&xoauth_display_name=Android+Device&source=android&lang=en&client_id=1070009224336-sdh77n7uot3oc99ais00jmuft6sk2fg9.apps.googleusercontent.com&scope=https://www.google.com/accounts/OAuthLogin&access_type=offline&set_oauth_token_cookie=true&hl=en_
mar-v-in commented 9 years ago

Based on your logs, I changed a few bits and pushed them. The latest version should be available on http://files.brnmod.rocks/apps/GmsCore/Latest/ in a few minutes (or compile yourself). Please try it out and report back.

jamorford commented 9 years ago

Looks like it is working! Tested with Drive and Classroom. Thanks for looking into it.

jamorford commented 9 years ago

I would note though that I had to input my email an additional time after the changes. Not sure if that could be avoided or not. However, it is functional, so it's not something urgent.