How Not to Use Authentication Methods

It’s important that you know how to use Community Auth’s authentication methods, and due to feedback in the CodeIgniter forum, it’s clear that some developers are calling authentication methods more than once per request.

You don’t want to call more than one authentication method per request, because everything you need for authentication is done in the first request.

Authentication Methods

Use 1 Authentication Method Per Request!

In general, you will only use one authentication method per request. The reason why you only should use one method per request is that after that one method call you have all the authentication variables, and so you use them instead. Doing more calls to authentication methods just requires extra database queries you don’t need.


Exception for Optional Login

The only exception to restricting yourself to calling a single authentication method per request is for optional login, which is documented here.