“As-User” header enabled with our enterprise admin account with Box.com [BOX-API.V2]

非 Y 不嫁゛ 提交于 2019-12-24 14:28:36

问题


I got "As-User" header enabled with our enterprise admin account with Box.com to impersonate other users and trying to use the previously generated token without refreshing/regenerating every time. When I am trying to connect Box.com thru my vb.net code, getting "Box returned HTTP Code Unauthorized (Unauthorized): " error. What I am doing wrong? Do i need to write any extra code?

Do I need to compare the token generated file creation date with today's date for less than 60 days, in order to refresh/regenerate the token before it expires?

'''' Reading Refresh token from the file Dim streamReader As StreamReader streamReader = System.IO.File.OpenText(Server.MapPath("~\Box\BoxApiRefreshToken.txt")) oldRefreshToken = streamReader.ReadToEnd() streamReader.Close()

boxManager = New BoxManager(oldRefreshToken)


回答1:


Once you apply a new scope to your API key you have to walk through the manual OAuth process again for that scope to apply to your access token. Try logging in again through OAuth, generate a new access/refresh token pair, then attempt to make your request with the As-User header.

Keep in mind co-admins cannot attempt to make API requests as other co-admins or the primary admin.



来源:https://stackoverflow.com/questions/31277255/as-user-header-enabled-with-our-enterprise-admin-account-with-box-com-box-api

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!