Skip to content

Commit

Permalink
udpated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
nullx27 committed Aug 31, 2016
1 parent a048c2d commit 0fb7496
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 2 deletions.
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Eve Online Provider for Laravel Socialite

## Installation and config
Install Larvel Socialite (see here: https://github.com/laravel/socialite/blob/2.0/readme.md)

Install the eveonline socialite provider

```
composer require nullx27/eveonline-socialite
```

Add the follwing to your .env file:

```
Expand All @@ -10,9 +17,58 @@ EVEONLINE_CLIENT_SECRET=
EVEONLINE_REDIRECT=
```

(Get your Eve Online SSO credentials here: https://developers.eveonline.com/applications/)

Add the following to your config/app.php
```
nullx27\Socialite\EveOnline\EveOnlineServiceProvider::class,
```

Get your Eve Online SSO credentials here: https://developers.eveonline.com/applications/
## Usage

```
<?php
namespace App\Http\Controllers\Auth;
use Socialite;
class AuthController extends Controller
{
/**
* Redirect the user to the GitHub authentication page.
*
* @return Response
*/
public function redirectToProvider()
{
return Socialite::driver('eveonline')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return Response
*/
public function handleProviderCallback()
{
$user = Socialite::driver('eveonline')->user();
//dd($user);
}
}
```

## Retrieving User Details

Once you have a user instance, you can grab a few more details about the user:

```php
$user = Socialite::driver('eveonline')->user();

$token = $user->token;
$expiresIn = $user->expiresIn;
$user->getId();
$user->getName();
$user->getAvatar();
```
2 changes: 1 addition & 1 deletion src/Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function getUserByToken($token)
protected function mapUserToObject(array $user)
{
return (new User)->setRaw($user)->map([
'character_id' => $user['CharacterID'],
'id' => $user['CharacterID'],
'name' => $user['CharacterName'],
'owner_hash' => $user['CharacterOwnerHash'],
'avatar' => 'https://image.eveonline.com/Character/' . $user['CharacterID'] . '_128.jpg',
Expand Down

0 comments on commit 0fb7496

Please sign in to comment.