passport-qgame

    1.0.0 • Public • Published

    passport-qgame

    vivo 小游戏帐号接入 授权拿到code后,获取 access_token 并返回用户信息

    {
      "provider": "qgame",
      "expires_in": 86400,
      "refresh_token": "...",
      "access_token": "...",
      "nickname": "...",
      "openid": "...",
      "avatar": "..."
    }
    // express 使用示例
     
    const passport = require('passport');
    const QgameStrategy = require('passport-qgame');
     
    passport.use(new QgameStrategy({
      key, screct, passReqToCallback: true
    }, function(req, profile, done){
      // 处理 profile, 查找或创建用户
      const user = User.findOrCreate();
     
      // 完成
      done(null, user);
    }));
     
    // router
    app.get("/auth/qgame", passport.authenticate('qgame', {
      session: false,
      successReturnToOrRedirect: null,
    }), function() {});
     

    License

    MIT

    Install

    npm i passport-qgame

    DownloadsWeekly Downloads

    0

    Version

    1.0.0

    License

    none

    Unpacked Size

    7.9 kB

    Total Files

    10

    Last publish

    Collaborators

    • lingye