OneDrive 身份验证后获取用户详细信息
Get user details after OneDrive authentication
我正在尝试使用 OneDrive API 对用户进行身份验证。用户身份验证已成功完成。但是,我还想在用户通过身份验证后获取用户电子邮件或姓名。下面是我当前的代码
ODClient.setMicrosoftAccountAppId(ODAppKey, scopes: ["wl.signin", "wl.offline_access", "onedrive.readonly", "onedrive.readwrite", "onedrive.appfolder"])
ODClient.clientWithCompletion({ (client, error) -> Void in
if(error == nil){
odClient = client
}
})
如何在用户通过身份验证后获取登录用户的详细信息。请帮忙
提前致谢
当您 retrieve a drive it returns an owner object that includes display name but email is not currently supported in the OneDrive API. This issue 跟踪添加该支持时。
我将其解决为:
ODClient.clientWithCompletion({ (client, error) -> Void in
if(error == nil){
odClient = client
self.getUserDetails()
}
})
func getUserDetails(){
odClient.drive().request().getWithCompletion { (drive, error) -> Void in
if(error == nil){
print("User name : \(drive.owner.user.displayName)")
}
}
}
注意:使用 OneDrive 我们只能获取为帐户设置的显示名称。
感谢@ginach
我正在尝试使用 OneDrive API 对用户进行身份验证。用户身份验证已成功完成。但是,我还想在用户通过身份验证后获取用户电子邮件或姓名。下面是我当前的代码
ODClient.setMicrosoftAccountAppId(ODAppKey, scopes: ["wl.signin", "wl.offline_access", "onedrive.readonly", "onedrive.readwrite", "onedrive.appfolder"])
ODClient.clientWithCompletion({ (client, error) -> Void in
if(error == nil){
odClient = client
}
})
如何在用户通过身份验证后获取登录用户的详细信息。请帮忙
提前致谢
当您 retrieve a drive it returns an owner object that includes display name but email is not currently supported in the OneDrive API. This issue 跟踪添加该支持时。
我将其解决为:
ODClient.clientWithCompletion({ (client, error) -> Void in
if(error == nil){
odClient = client
self.getUserDetails()
}
})
func getUserDetails(){
odClient.drive().request().getWithCompletion { (drive, error) -> Void in
if(error == nil){
print("User name : \(drive.owner.user.displayName)")
}
}
}
注意:使用 OneDrive 我们只能获取为帐户设置的显示名称。
感谢@ginach