An open API service indexing awesome lists of open source software.

https://github.com/symphonycms/members_login_oauth2

Logs in users using oAuth 2
https://github.com/symphonycms/members_login_oauth2

symphony-cms symphony-cms-extension symphony-cms-members

Last synced: 7 months ago
JSON representation

Logs in users using oAuth 2

Awesome Lists containing this project

README

          

# Members: oAuth 2 Login

> Logs in users using oAuth 2

### SPECS ###

Automatically creates account and logs in the user.
It uses the [oAuth 2 client from The PHP League](https://github.com/thephpleague/oauth2-client).

### REQUIREMENTS ###

- Symphony CMS version 2.7.x and up (as of the day of the last release of this extension)
- Members extension version 1.9.0

### INSTALLATION ###

- `git clone` / download and unpack the tarball file
- Put into the extension directory
- Enable/install just like any other extension

You can also install it using the [extension downloader](http://symphonyextensions.com/extensions/extension_downloader/).

For more information, see

### HOW TO USE ###

- Enable the extension
- Create a new Member section with only a email field (no password)
- Optionally, create a input/textarea/textbox field for the oAuth 2 username, avatar and refresh token.
- Set the required configuration values:

```php
###### MEMBERS_OAUTH2_LOGIN ######
'members_oauth2_login' => array(
'key' => 'REPLACE ME',
'secret' => 'REPLACE ME',
'redirect-uri' => 'https://yoursite.example.com/your-redirect-url/',
'url-authorize' => 'https://provider.example.com/your-authorize-url/',
'url-access-token' => 'https://provider.example.com/your-access-token-url/',
'url-resource-owner' => 'https://provider.example.com/your-resource-owner-url/',
'oauth2-email-field' => 'REPLACE ME with a field id if you want to save the oauth2 email',
'oauth2-username-field' => 'REPLACE ME with a field id if you want to save the oauth2 username',
'oauth2-avatar-field' => 'REPLACE ME with a field id if you want to save the oauth2 avatar',
'oauth2-refresh-token' => 'REPLACE ME with a field id if you want to save the oauth2 refresh token',
),
########
```

- Create a "oAuth2" page and attach the "Members: oAuth 2 login" event on it.
- Create the login form:

```html




Log in with oAuth 2 Provider

```

This form will redirect the user to your oauth2 login page.
After the users logs in, your oauth 2 service will redirect the user your redirect uri.

- Add another form to handle the actual log in process when the user comes back from oauth2 on your redirect uri.

- To make this process transparent for the end user, this form can be auto-submitted via javascript.

```xslt




Validate

if (window.oauth2form) oauth2form.submit();

```

- If everything works, the user will be redirected to the 'redirect' value, just like the standard Members login.

- To log out the user, use the default member logout or add this form to any page:

```xslt


Logout

```

### SPONSOR ###

Thanks to [Wannes Debusschere](https://github.com/wdebusschere) for its financial contribution leading to the initial development of this extension.

### LICENSE ###

MIT