We have moved to GitHub Issues
Created by Pavel Budík 12 May 2017, 15:02:46 Updated by Shannon Deminick 24 May 2017, 05:39:25Tags: Unscheduled
Subtask of: U4-9609
After 7.6.1 upgrade, it is no longer possible to link user account to an external ID via external login provider. After the external login workflow completes (redirect to external login, redirect back to backoffice), everything seems fine, except that the account is not linked.
The issue is caused by the DB transaction which inserts the new binding into the umbracoExternalLogin table being aborted. That is caused by the new scopes framework. ExternalLoginService leaks scopes [here|https://github.com/umbraco/Umbraco-CMS/blob/release-7.6.1/src/Umbraco.Core/Services/ExternalLoginService.cs#L30] and [here|https://github.com/umbraco/Umbraco-CMS/blob/release-7.6.1/src/Umbraco.Core/Services/ExternalLoginService.cs#L47] -- the GetByQuery methods are not executed until the returned IEnumerables are enumerated (because of WhereNotNull() [lazy evaluation|https://github.com/umbraco/Umbraco-CMS/blob/release-7.6.1/src/Umbraco.Core/Persistence/Repositories/RepositoryBase.cs#L280]). However, at this moment, the enclosing scope is already completed, causing trouble for the following scopes (especially the one creating the external login record). Detailed explanation is a little complicated and I'm must admit I don't understand the scopes framework very well...
A solution could be to add .ToList() somwhere -- either to the GetByQuery method (which would solve possible issues for all repositories) or just to those two aforementioned methods... Have tried it and it works but I'm not sure it wouldn't cause some other errors elsewhere.
@zpqrtbnk Can you investigate this please?
Review = should work.
Amazing bug report BTW.
Thanks :). After spending some hours debugging the oauth process itself, a few more diving into the new scopes fw were fun :)
Backwards Compatible: True
Affected versions: 7.6.1
Due in version: 7.6.2