Added integration test for adding affiliations using authorization code,
and filled in missing pieces of API for affiliations.