Auth0 处理被拒绝的权限
Auth0 handling declined permissions
我的 Auth0 帐户使用 facebook(和其他)登录。
- 当用户第一次批准fb申请时,他必须批准权限(例如电子邮件)。
- 用户可以取消选中电子邮件,拒绝电子邮件权限。
- 他仍然批准了申请,只是没有这个权限。
我在 Auth0 规则中检测到这一点并且登录失败但是当用户再次单击登录时他没有看到 facebook 批准屏幕并且无法重新批准电子邮件权限。
总之,用户卡住了!唯一的解决办法是手动删除用户的应用程序。
有什么想法吗?
一些进步:
我发现facebook sdk支持auth_type:"rerequest"
但是如何将它传递给 Auth0?
尝试使用 prompt=consent
作为查询字符串中的附加参数。如果您正在使用锁定:
auth0Lock.show({
...
authParams: { scope: 'openid offline_access', prompt:'consent'
},
...
})
终于解决了!
得到了 auth0 支持的一些帮助
我们需要设置
prompt: 'consent'
这里有 2 个例子:
使用 Auth0Lock(小部件)对象:
auth0Lock.show({
callbackURL: window.location.href, //where to go back. must allow this url in dashboard
responseType: 'token', //this will cause the hash to return the token
authParams: {
scope: 'openid offline_access',
prompt: 'consent' // THIS WILL ASK THE USER TO APPROVE THE PERMISSIONS THAT HE DECLINED EARLIER
},
connection_scopes: {
'facebook': ['public_profile', 'email'], //this optional this this example
}
});
使用 Auth0 对象:
auth0.login({
popup: true, // to use popup and js callback or redirect with hashtag
connection: 'facebook',
state:"some_state"
scope: 'openid offline_access',
prompt: 'consent'
},
//if popup=true then will callback
function (err, profile, id_token, access_token, state, refreshToken) {
if (err) {
console.log("err", err);
} else {
console.log(id_token);
}
});
我的 Auth0 帐户使用 facebook(和其他)登录。
- 当用户第一次批准fb申请时,他必须批准权限(例如电子邮件)。
- 用户可以取消选中电子邮件,拒绝电子邮件权限。
- 他仍然批准了申请,只是没有这个权限。
我在 Auth0 规则中检测到这一点并且登录失败但是当用户再次单击登录时他没有看到 facebook 批准屏幕并且无法重新批准电子邮件权限。
总之,用户卡住了!唯一的解决办法是手动删除用户的应用程序。
有什么想法吗?
一些进步:
我发现facebook sdk支持auth_type:"rerequest" 但是如何将它传递给 Auth0?
尝试使用 prompt=consent
作为查询字符串中的附加参数。如果您正在使用锁定:
auth0Lock.show({
...
authParams: { scope: 'openid offline_access', prompt:'consent'
},
...
})
终于解决了!
得到了 auth0 支持的一些帮助
我们需要设置
prompt: 'consent'
这里有 2 个例子:
使用 Auth0Lock(小部件)对象:
auth0Lock.show({
callbackURL: window.location.href, //where to go back. must allow this url in dashboard
responseType: 'token', //this will cause the hash to return the token
authParams: {
scope: 'openid offline_access',
prompt: 'consent' // THIS WILL ASK THE USER TO APPROVE THE PERMISSIONS THAT HE DECLINED EARLIER
},
connection_scopes: {
'facebook': ['public_profile', 'email'], //this optional this this example
}
});
使用 Auth0 对象:
auth0.login({
popup: true, // to use popup and js callback or redirect with hashtag
connection: 'facebook',
state:"some_state"
scope: 'openid offline_access',
prompt: 'consent'
},
//if popup=true then will callback
function (err, profile, id_token, access_token, state, refreshToken) {
if (err) {
console.log("err", err);
} else {
console.log(id_token);
}
});