class Users \ UserOAuth2


Allows users to be logged in with OAuth2. Based on https://github.com/thephpleague/oauth2-client


Method Summary

Name Description
addIdentity(Connection $db, User $user, OAuth2Providers $provider)
auth(ProviderInterface $provider) Execute OAuth2 authentication and return the user.
removeIdentity(Connection $db, User $user, $provider, $uid) Remove the given OAuth2 identity from the given user.
tryLogin(Connection $db, OAuth2Providers $provider) Try logging in as a user with the given email and password.
trySignup(Connection $db, OAuth2Providers $provider)

static function addIdentity(Connection $db, User $user, OAuth2Providers $provider)

Throws:
UserSignupException - if the user could not be signed up, with a reason
UserAlreadyExistsException - if the identity already exists in the database

static function auth(ProviderInterface $provider)

Execute OAuth2 authentication and return the user.


static function removeIdentity(Connection $db, User $user, $provider, $uid)

Remove the given OAuth2 identity from the given user.


static function tryLogin(Connection $db, OAuth2Providers $provider)

Try logging in as a user with the given email and password.

Parameters:
$redirect - the registered redirect URI
Returns:
a valid User
Throws:
UserAuthenticationException - if the user could not be logged in, with a reason

static function trySignup(Connection $db, OAuth2Providers $provider)

Returns:
the created User
Throws:
UserSignupException - if the user could not be signed up, with a reason
UserAlreadyExistsException - if the user already exists in the database