Home > Mobile >  Developers can access their user information, is this why?
Developers can access their user information, is this why?

Time:09-23

The same code, a developer can get the user information, and the other a developer but can't get the what is

For example, you and I are the same small application developers of the project, under the condition of the same code, I can't get user information, but you can, I changed after the appid is normal also get user information, this is what circumstance, the following code

//app. Js

The App ({

OnLaunch: function () {

//display local storage capacity

Var logs=wx. GetStorageSync (' logs') | | []



Logs. The unshift (Date. Now ())

Wx. SetStorageSync (' logs' logs)



Wx. Cloud. Init ({

Env: 'a111 - ypiun',

TraceUser: true,

})

//login

Wx. Login ({

Success: res=& gt; {

//send res. The code to the background for openId, sessionKey, unionId

If (res) code) {

//the console. The log (" this is app. Js ")

//this. OnGetOpenid ()

} else {

The console. The log (' login failed! '+ res. ErrMsg)

}



}

})

//get the user information

Wx. GetSetting ({

Success: res=& gt; {

If (res) authSetting [' scope. The userInfo ']) {

//have the authority to direct call getUserInfo head is to get the nickname, not bounced

Wx. GetUserInfo ({

Success: res=& gt; {

//res sent to the background can be decoded unionId

Enclosing globalData. The userInfo=res. The userInfo

//the console. The log (" this is app ")



//the console. The log (this. GlobalData. The userInfo)

//since getUserInfo is network request, may be on the Page. The onl oad before returning to

//so I join the callback to prevent this kind of circumstance

If (this. UserInfoReadyCallback) {

Enclosing userInfoReadyCallback (res)

}

}

})

}

}

})

},

GlobalData: {

The userInfo: null,

Openid: "'

UserID: [],

},

OnGetOpenid: function () {

//call cloud function for openID

Var that=this

Wx. Cloud. CallFunction ({

Name: 'login',

Data: {},

Success: res=& gt; {

That. GlobalData. Openid=res. Result. The openid

The console. The log (' [cloud function] [login] user openid: ', res. Result. The openid)



},

Fail: err=& gt; {

The console. The error (' [cloud function] [login] call 'failure, err)

}

})

The console. The log (enclosing globalData. Openid)

},



})

:) :

CodePudding user response:

Considering
1: changes in the SDK version, set
2: the ide problem
3: whether normal login account developers

CodePudding user response:

What you said is not clear, who get the information, one can not ok,
I default is when debugging or preview you can't get your information, but the other developers will be able to get his information, so may be you once get the user permissions, select the cancel, then don't pop up, so has been not available, you can see a small program set permissions inside the user information is checked, can also be cleared the data in a development tool, and try again