1.0.2 • Published 9 months ago

micro-app-auth v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
9 months ago

micro-app-auth

WeChat microApp or other microApp user Auth lib

example

// for wx
import CheckAuthClient, {Config, ExecuteOptions} from 'micro-app-auth'

// of second params, is current microApp platform, or wx or tt or ...
const checkAuthClient = new CheckAuthClient({ scope: 'userLocation' }, wx)


/**
 * or execute location API
 * checkAuthClient ==> execute
 */
checkAuthClient.execute({
  success(res) {
    console.log(res)
  },
  fail(err) {
    console.log(err)
  }
})

/**
 * check userLocation auth
 * when of record auth, you should use tt.getRecorderManager.start()
 * This is more suitable for you to use
 */
async function getLocation() {
  await checkAuthClient.checkAuth()
  wx.getLocation({
    success: res => console.log(res)
  })
}
1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago