<commit_before>#Social Auth .go

The SocialAuth package enables you to verify the OAuth2 authentication tokens issued by the social providers. 

At the moment only two providers are available (Facebook and Google).  

## Installation

```
go get github.com/dimitark/socialauth
```

```go
import "github.com/dimitark/socialauth"
```

## Usage

### Configuration

Before using the library - it needs to be configured. The library expects to have valid application IDs for every configured provider. 

```go
config := map[socialauth.Provider]map[string]string{
		socialauth.Facebook: map[string]string{
			"appAccessToken": "YOUR_APP_ACCESS_TOKEN",
		},
		socialauth.Google: map[string]string{
			"appClientId": "YOUR_GOOGLE_APP_CLIENT_ID",
		},
	}
```

After setting up the configuration, the library can be used in two ways:

* independently
* as a middleware


### Independent usage

```go
auth := socialAuth.NewSocialAuthWithConfigs(config)
if provider := auth.Get(socialauth.Facebook); provider != nil {
	userID, err := provider.VerifyToken("USER_TOKEN")
	if err != nil {
		// Authentication failed!
	} else {
		// Success
	}
}
```

### Middleware usage

Usually this library will be used as part of a middleware. For that reason, the library provides a middleware implementation, that plays nicelly with the **negroni & gorilla** libraries.

```go
n := negroni.New()
n.Use(socialauth.NewMiddleware(config, context.Set))
```<commit_msg>Proposed changes to Readme.MD<commit_after>#Social Auth .go

The SocialAuth package enables you to verify the OAuth2 authentication tokens issued by social providers. 

At the moment only two providers are available (Facebook and Google).  

## Installation

```
go get github.com/dimitark/socialauth
```

```go
import "github.com/dimitark/socialauth"
```

## Usage

### Configuration

You need to configure the client, before you can use it. The library requires valid application IDs for each configured provider. 

```go
config := map[socialauth.Provider]map[string]string{
		socialauth.Facebook: map[string]string{
			"appAccessToken": "YOUR_APP_ACCESS_TOKEN",
		},
		socialauth.Google: map[string]string{
			"appClientId": "YOUR_GOOGLE_APP_CLIENT_ID",
		},
	}
```

The library can be used in two ways:

* independently
* as middleware


### Independent usage

```go
auth := socialAuth.NewSocialAuthWithConfigs(config)
if provider := auth.Get(socialauth.Facebook); provider != nil {
	userID, err := provider.VerifyToken("USER_TOKEN")
	if err != nil {
		// Authentication failed!
	} else {
		// Success
	}
}
```

### Middleware usage

You can use it as a middleware for both **negroni** OR **gorilla** 

An example using **negroni**:

```go
n := negroni.New()
n.Use(socialauth.NewMiddleware(config, context.Set))
```
{'fraction_non_alphanumeric': 0.11679361624954661, 'fraction_numerical': 0.0007254261878853826, 'mean_word_length': 4.757828810020877, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '694287', 'n_tokens_mistral': 894, 'n_tokens_neox': 832, 'n_words': 270}