<commit_before>package api

import (
	"koding/db/mongodb"
	"socialapi/config"
	"socialapi/workers/common/handler"
	"socialapi/workers/common/mux"

	"github.com/RangelReale/osin"
	"github.com/osin-mongo-storage/mgostore"
	"gopkg.in/mgo.v2"
)

const (
	OauthAuthorization = "oauth-authorization"
	GenerateToken      = "generate-token"
)

// AddHandlers adds handlers for slack integration
func AddHandlers(m *mux.Mux, config *config.Config) {
	mgo = mongodb.NewMongoDB(config.Mongo)
	session := mgo.Session
	dbName := ""

	oauth := NewOAuthHandler(session, dbName)
	m.AddUnscopedHandler(
		handler.Request{
			Handler:  oauth.AuthorizeClient,
			Name:     OauthAuthorization,
			Type:     handler.GetRequest,
			Endpoint: "/oauth/authorize",
		},
	)<commit_msg>go/oauth: get session with modelhelper package<commit_after>package api

import (
	"koding/db/mongodb/modelhelper"
	"socialapi/config"
	"socialapi/workers/common/handler"
	"socialapi/workers/common/mux"

	"github.com/RangelReale/osin"
	"github.com/osin-mongo-storage/mgostore"
	"gopkg.in/mgo.v2"
)

const (
	OauthAuthorization = "oauth-authorization"
	GenerateToken      = "generate-token"
)

// AddHandlers adds handlers for slack integration
func AddHandlers(m *mux.Mux, config *config.Config) {
	session := modelhelper.Mongo.Session
	// probably this name is gonna be changed after implemetation is done.
	dbName := "oauthMongo"

	oauth := NewOAuthHandler(session, dbName)
	m.AddUnscopedHandler(
		handler.Request{
			Handler:  oauth.AuthorizeClient,
			Name:     OauthAuthorization,
			Type:     handler.GetRequest,
			Endpoint: "/oauth/authorize",
		},
	)
{'fraction_non_alphanumeric': 0.12106238418777023, 'fraction_numerical': 0.0012353304508956147, 'mean_word_length': 4.311475409836065, 'pattern_counts': {'":': 0, '<': 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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3622896', 'n_tokens_mistral': 613, 'n_tokens_neox': 580, 'n_words': 104}