Add authentication

@tomaszdurka please review.
Previously it was #3
Depends on #4