-
Note: This documentation applies to Invision Community 4.3 and higher only. For older versions, see 4.2 and below: Login Handlers. Basic functionality will be backwards compatible.
Introduction
Invision Community allows users to log in using a number of different Login Handlers. For example, in addition to the "Standard" login handler where the user enters their email address or display name and password that they used to register, users can also log in with their Facebook acco
-
To make a login handler where the user enters a username or email address and password you will add the \IPS\Login\Handler\UsernamePasswordHandler trait to your Login Handler class and implement the two methods it requires:
authenticateUsernamePassword() is called when a user enters a username or email address and password into the login form. You need to verify if it is valid in your login handler and return an \IPS\Member object if it is (including creating the account if there isn't one
-
Note: If you are creating an OAuth-based Handler, see Creating an OAuth-Based Handler. Only use this documentation for non-OAuth-based Handlers.
To make a login handler where the user clicks a button (that is not OAuth-based) you will add the \IPS\Login\Handler\ButtonHandler trait and implement the methods it requires:
buttonColor(), buttonIcon(), buttonText() and buttonClass() control how the button looks.
authenticateButton() handles what happens when the button is clicked. Y
-
Note: For OAuth 2.0 based logins, administrators can normally use the "Other OAuth 2.0" option when creating a Login Method and provide more details in settings. However, you might want to implement a complete Login Handler to allow ease of setup or to provide additional options and features.
Note: This documentation assumes familiarity with common terms and concepts used by OAuth.
To make a Login Handler which uses OAuth, first change the class you have already written to extend one o
-
You will probably need some settings for the administrator to fill in when they set up a Login Method for your Handler in the AdminCP.
Some settings are already provided. You do not need to do anything with them, as Invision Community will handle the values automatically:
A name for the login method (the default value will be that which is provided by the getTitle() method).
Whether AdminCP logins are enabled
Whether new accounts are allowed
If you are using a Use
-
Users may want to sync some of their details from your login handler's database to the community. The data that can be synced is:
Display name
Email address
Profile photo
Cover photo
Status updates
For example, users who have logged in with Facebook can use their Facebook profile photo on the community, and optionally update the email address used on the community if they change it on Facebook. Your login handler can provide this syncing too.
Even if t
-
Handling Account Changes
You may want to change the display name, email address and/or password in your Login Handler's database when the user changes those details locally. This is especially likely for Username/Password Handlers.
There are lots of possible combinations of login handlers. A community might be using your login handler in combination with many other different handlers, or they might be using only your login handler and even have disabled the standard login handler. Th