Exemple #1
0
func AutomaticRedirect(c *gin.Context) {

	oauthUrl := "https://accounts.automatic.com/oauth/access_token"
	postData := url.Values{
		"grant_type":    {"authorization_code"},
		"code":          {c.Query("code")},
		"client_id":     {config.ClientId()},
		"client_secret": {config.ClientSecret()},
	}

	resp, _ := http.PostForm(oauthUrl, postData)
	defer resp.Body.Close()
	body, _ := ioutil.ReadAll(resp.Body)

	c.HTML(http.StatusOK, "master.tmpl", gin.H{"content": string(body)})
}
Exemple #2
0
func Dashboard(c *gin.Context) {
	session := sessions.Get(c)
	content := utils.Render("templates/dashboard.tmpl", gin.H{"handle": session.Handle, "client_id": config.ClientId()})
	c.HTML(http.StatusOK, "master.tmpl", gin.H{"content": template.HTML(content)})
}