Exemple #1
0
package main

import (
	"fmt"

	"github.com/chanxuehong/wechat/open/oauth2"
	"net/url"
)

var appid = ""
var appsecret = ""
var redirectURL = "dev.beautifulreading.com"
var scopes = "snsapi_userinfo"
var oauth2Config = oauth2.NewConfig(appid, appsecret, redirectURL, scopes)

func main() {
	var state = "what"
	v := url.Values{}
	v.Set("name", "Ava")

	str := oauth2.AuthCodeURL(appid, redirectURL, scopes, state, v)
	fmt.Println(str)
}
Exemple #2
0
package web

import (
	"github.com/chanxuehong/wechat/open/oauth2"

	"github.com/aiyi/go-user/config"
)

var oauth2Config = oauth2.NewConfig(
	config.ConfigData.Weixin.Open.Web.AppId,
	config.ConfigData.Weixin.Open.Web.AppSecret,
	"unused",
	"snsapi_login",
)
Exemple #3
0
package app

import (
	"github.com/chanxuehong/wechat/open/oauth2"

	"github.com/aiyi/go-user/config"
)

var oauth2Config = oauth2.NewConfig(
	config.ConfigData.Weixin.Open.App.AppId,
	config.ConfigData.Weixin.Open.App.AppSecret,
	"unused",
	"snsapi_userinfo",
)