Issue 1623 resume to relier

Should we move all of this logic into an OAuth Relier?