Auth with tests

Authentication + Tests

Better setup for Unit and E2E tests

When the PR is merged I'll make some changes to the Wiki regarding this
you don't need to create the deferred object above since you can return this promise directly.