All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tmsps.ne4weixin.config.constant.OAUTH2 Maven / Gradle / Ivy

There is a newer version: 3.2.2.3
Show newest version
package com.tmsps.ne4weixin.config.constant;

/**
 * @Title: OAUTH2.java
 * @Package: com.tmsps.ne4weixin.config.constant
 * @Description: 微信API 网页授权请求url
 * @author: hanjiefei
 * @date: 2019-10-22
 * @version V1.0
 * @Copyright: 2019 nuoyun All rights reserved.
 */
public interface OAUTH2 {

	/**
	 * 用来获取进入页面的用户的openid
	 */
	String SNSAPI_BASE = "snsapi_base";
	/**
	 * 用来获取用户的基本信息
	 */
	String SNSAPI_USERINFO = "snsapi_userinfo";
	/**
	 * 用户同意授权,获取code
	 * 注: 若提示“该链接无法访问”,请检查参数是否填写错误,是否拥有scope参数对应的授权作用域权限。
	 */
	String GET_CODE = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=%s#wechat_redirect";
	/**
	 * 通过code换取网页授权access_token
	 * 参数		是否必须	说明
	 * appid		是	公众号的唯一标识
	 * secret		是	公众号的appsecret
	 * code			是	填写第一步获取的code参数
	 * grant_type	是	填写为authorization_code
	 */
	String GET_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code";
	/**
	 * 刷新access_token
	 * 参数			是否必须	说明
	 * appid			是	公众号的唯一标识
	 * grant_type		是	填写为refresh_token
	 * refresh_token	是	填写通过access_token获取到的refresh_token参数
	 */
	String REFRESH_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=%s&grant_type=refresh_token&refresh_token=%s";
	/**
	 * 拉取用户信息(需scope为 snsapi_userinfo),http:GET(请使用https协议) 
	 */
	String GET_USER_INFO = "https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=%s";
	/**
	 * 检验授权凭证(access_token)是否有效,http:GET(请使用https协议)
	 */
	String CHECK_ACCESS_TOKEN = "https://api.weixin.qq.com/sns/auth?access_token=%s&openid=%s";
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy