Skip to content

Lupeiwen0/micro-app-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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('getLocation', {
  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)
  })
}

About

wechat microApp or other microApp user Auth lib

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published