inboxapp/inbox — pull request #104 by StefanIvanciuc (2014-11-17 15:36:39+00:00)
Title: Implemented auth api

All auth api routes must be accessed via *post* with *json* data as post body.

The **"/auth/login"** route will resolve the provider and return it's **name and type**. If the provider is an implemented oauth provider, will also return the *authorization an url*.
Post parameters: *email*(the email address to authenticate), *reauth*(if address is already authenticated shall it be reauthenticated?, boolean, optional)

The next step is based on the **provider type** returned by the route above.

If the provider type is **oauth**:
* If the provider name is **gmail** we must access **"/auth/gmail"** route, providing the authorization code received from accessing the link returned by the **"/auth/login"** route. If the code is valid the email address will be authenticated with inbox else an error will be returned. Post parameters: *email*, *code*(authorization code)
* If provider name is **outlook**: **"/auth/outlook"** - same as above, only for outlook accounts

If the provider type is **generic**:
* A generic provider means that inbox already has the imap settings for the given provider. The **"/auth/generic"** route does the trick for this. Post parameters: *email*, *password*.

If the provider type is **custom**:
* Unknown provider, inbox does not have the predefined imap settings for this provider. The **"/auth/custom"** route handles this type of providers. Post parameters: *email*, *password*, *imap_server_host*, *imap_server_port*(optional, default 993), *smtp_server_host*, *smtp_server_port*(optional, default 587).