Giter VIP home page Giter VIP logo

weapp-session-client's Introduction

重要声明:本微信小程序会话管理客户端代码是探索阶段的产物,仅供研究学习,其使用的协议、算法均未和微信最新的要求对齐。生产环境请移步使用 Wafer

微信小程序会话管理 - 客户端

微信的网络请求接口 wx.request() 没有携带 Cookies,这让传统基于 Cookies 实现的会话管理不再适用。为了让处理微信小程序的服务能够识别会话,我们推出了 weapp-session

weapp-session 使用自定义 Header 来传递微信小程序内用户信息,在服务内可以直接获取用户在微信的身份。

本客户端需要配合服务器代码使用。

客户端的使用比较简单,提供了一个和 wx.request 参数一样的方法:

const request = require('./lib/session-request.js');

request({
    url: 'https://www.mydomain.com/myapi',
    success(data) {
        console.log(data);
    }
});

具体使用可以参照 pages/example/example.js 的代码。

要使用本客户端,需要至少引用 lib 目录下的 co.jspromisify.js 以及 session-request.js

weapp-session-client's People

Contributors

techird avatar

Watchers

James Cloos avatar lucky-candy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.