func makeBasicAuthRequest(client *http.Client, username string, password string, marshalledJson []byte, twoFA string) *http.Response {
	jsonBody := bytes.NewBuffer(marshalledJson)
	req, err := http.NewRequest("POST", authorizationUrl, jsonBody)
	if err != nil {
		fmt.Printf("%s\n", err)
		os.Exit(1)
	}
	req.SetBasicAuth(username, password)
	if twoFA != "" {
		req.Header.Add("X-GitHub-OTP", twoFA)
	}
	resp, err := client.Do(req)
	if err != nil {
		fmt.Printf("%s\n", err)
		os.Exit(1)
	}
	return resp
}
makeBasicAuthRequest will create a POST request to create a new authorization
with basic auth enabled.
See: https://developer.github.com/v3/oauth_authorizations/#create-a-new-authorization
It takes user's username, user's password, marshalled json and 2fa code if user has enabled it.
It returns a new Request.
package OAuth
import (
	"bytes"
	"encoding/json"
	"fmt"
	"github.com/MaximeD/gost/json/oauth"
	"io/ioutil"
	"net/http"
	"os"
	"time"
)
var baseUrl string = "https://api.github.com/"
var authorizationUrl string = baseUrl + "authorizations"
func GetToken() string {
	client := &http.Client{}
	var authorizationResponseBody []byte
	var twoFA string
	username, password := askUserForCredentials()
	authenticationJson := getAuthenticationJson(false)
	resp := makeBasicAuthRequest(client, username, password, authenticationJson, twoFA)
	defer resp.Body.Close()
	if resp.StatusCode == 401 && resp.Header.Get("X-Github-Otp") != "" {
		twoFA = askUserForTwoFA()
		resp = makeBasicAuthRequest(client, username, password, authenticationJson, twoFA)
		defer resp.Body.Close()
	}
	if resp.StatusCode == 422 {
		authenticationJson = getAuthenticationJson(true)
		resp = makeBasicAuthRequest(client, username, password, authenticationJson, twoFA)
		defer resp.Body.Close()
	}
	if resp.StatusCode != 201 {
		fmt.Println("Sorry but we could not authenticate you.")
		fmt.Println("No gist were created...")
		os.Exit(1)
	}
	authorizationResponseBody, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		fmt.Printf("%s\n", err)
		os.Exit(1)
	}
	var jsonRes OAuthJSON.GetSingleAuthResponse
	err = json.Unmarshal(authorizationResponseBody, &jsonRes)
	if err != nil {
		fmt.Printf("%s\n", err)
		os.Exit(1)
	}
	return jsonRes.Token
}
func askUserForCredentials() (username string, password string) {
	fmt.Println("GitHub username:")
	fmt.Scanln(&username)
	fmt.Println("GitHub password:")
	fmt.Scanln(&password)
	return username, password
}