New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

awesome-wechat-sdk

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

awesome-wechat-sdk - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

16

lib/wechat.d.ts

@@ -30,9 +30,10 @@ import { UrlLibOptions } from './types/urllib';

openid: string;
nickname: string;
sex: '1' | '2';
province: string;
city: string;
country: string;
headimgurl: string;
privilege: string[];
scope: string;
nickname?: string;
sex?: '1' | '2';
province?: string;
city?: string;
country?: string;
headimgurl?: string;
privilege?: string[];
unionid?: string;

@@ -100,5 +101,4 @@ }

getAuthUser(openid: string, lang?: 'zh_CN' | 'zh_TW' | 'en'): Promise<UserInfo>;
getOpenidByCode(code: string): Promise<string>;
getAuthUserByCode(code: string, lang?: 'zh_CN' | 'zh_TW' | 'en'): Promise<UserInfo>;
private verifyToken(openid, accessToken);
}

@@ -237,5 +237,5 @@ "use strict";

_getAuthUser(openid, token, lang) {
const url = `${this.endpoint}/sns/userinfo?access_token=${token}&openid=${openid}&lang=${lang}`;
const url = `${this.endpoint}/sns/userinfo?access_token=${token.accessToken}&openid=${openid}&lang=${lang}`;
return this.request(url, { dataType: 'json' }).then((response) => {
return processWechatResponse(response.data);
return Object.assign({ scope: token.scope }, processWechatResponse(response.data));
});

@@ -250,8 +250,14 @@ }

}
if (token.isValid()) {
return this._getAuthUser(openid, token.accessToken, lang);
if (token.scope.indexOf('snsapi_userinfo') >= 0) {
return {
openid,
scope: token.scope
};
}
else if (token.isValid()) {
return this._getAuthUser(openid, token, lang);
}
else {
return this.refreshAuthAccessToken(token.refreshToken).then((token) => {
return this._getAuthUser(openid, token.accessToken, lang);
return this._getAuthUser(openid, token, lang);
});

@@ -261,7 +267,2 @@ }

}
getOpenidByCode(code) {
return this.getAuthAccessToken(code).then((token) => {
return token.openid;
});
}
getAuthUserByCode(code, lang = 'zh_CN') {

@@ -268,0 +269,0 @@ return this.getAuthAccessToken(code).then((token) => {

{
"name": "awesome-wechat-sdk",
"version": "1.2.0",
"version": "1.3.0",
"description": "an awesome sdk for wechat oauth and api",

@@ -5,0 +5,0 @@ "scripts": {

@@ -64,9 +64,10 @@ import * as urllib from 'urllib';

openid: string;
nickname: string;
sex: '1' | '2';
province: string;
city: string;
country: string;
headimgurl: string;
privilege: string[];
scope: string;
nickname?: string;
sex?: '1' | '2';
province?: string;
city?: string;
country?: string;
headimgurl?: string;
privilege?: string[];
unionid?: string;

@@ -292,6 +293,6 @@ }

private _getAuthUser(openid: string, token: string, lang: 'zh_CN' | 'zh_TW' | 'en'): Promise<UserInfo> {
const url = `${this.endpoint}/sns/userinfo?access_token=${token}&openid=${openid}&lang=${lang}`;
private _getAuthUser(openid: string, token: AuthAccessToken, lang: 'zh_CN' | 'zh_TW' | 'en'): Promise<UserInfo> {
const url = `${this.endpoint}/sns/userinfo?access_token=${token.accessToken}&openid=${openid}&lang=${lang}`;
return this.request(url, {dataType: 'json'}).then((response) => {
return processWechatResponse(response.data);
return Object.assign({scope: token.scope}, processWechatResponse(response.data));
});

@@ -307,7 +308,12 @@ }

}
if (token.isValid()) {
return this._getAuthUser(openid, token.accessToken, lang);
if (token.scope.indexOf('snsapi_userinfo') >= 0) {
return {
openid,
scope: token.scope
};
} else if (token.isValid()) {
return this._getAuthUser(openid, token, lang);
} else {
return this.refreshAuthAccessToken(token.refreshToken).then((token) => {
return this._getAuthUser(openid, token.accessToken, lang);
return this._getAuthUser(openid, token, lang);
});

@@ -318,8 +324,2 @@ }

getOpenidByCode(code: string): Promise<string> {
return this.getAuthAccessToken(code).then((token) => {
return token.openid;
});
}
getAuthUserByCode(code: string, lang: 'zh_CN' | 'zh_TW' | 'en' = 'zh_CN'): Promise<UserInfo> {

@@ -326,0 +326,0 @@ return this.getAuthAccessToken(code).then((token) => {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc