Updated to rfc6749.  Added backward compatibility to match facebook implementation. Simpler flow.