Open gjohncock opened 7 years ago
hi @gjohncock the adalAuthProvider is used for old pattern to get resourceId by DiscoveryService and then passing the refresh token and serviceResourceId in. For you as I saw you are using graph API, I would suggest you start with the new Graph SDK stack.
great, thanks for the direction. i will look into this...
I need to set up OneDrive to stay logged in so after much researching and testing I have arrived at the following code. Everything works up to the point of accessing the OneDrive drive (code line that reads myDrv = Await odc.Drive.Request.GetAsync). The Stack Trace shows that the token is assigned successfully however i get the following error...
`Exception thrown: 'Microsoft.Graph.ServiceException' in mscorlib.dll Microsoft.IdentityModel.Clients.ActiveDirectory Information: 2 : 8/03/2017 1:33:22 AM: 6f67595b-... - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned: Access Token Hash: 6nRavv.... Refresh Token Hash: jGnzim1W6Cw... Expiration Time: 8/03/2017 2:33:21 AM +00:00 User Hash: null
CFSOneDriveSync.vshost.exe Information: 0 : 8/03/2017 1:33:22 AM: 6f67595b-... - AcquireTokenHandlerBase: === Token Acquisition finished successfully. An access token was retuned: Access Token Hash: 6nRavv.... Refresh Token Hash: jGnzim1W6Cw... Expiration Time: 8/03/2017 2:33:21 AM +00:00 User Hash: null `
Here is the code...
`Imports Microsoft.OneDrive.Sdk Imports Microsoft.OneDrive.Sdk.Authentication Imports Microsoft.Azure.ActiveDirectory.GraphClient Imports Microsoft.IdentityModel.Clients.ActiveDirectory
Shared siteprefix As String = "/sites/dev" Shared clientId As String = "dr44f435-...." Shared clientSecret As String = "aQhnY6nJlqqaQXjU/UyQ...." Shared odc As OneDriveClient Shared myDrv As Drive Shared TokenForApplication As String
Public Const AadReturnUrl As String = "urn:....0:oob" Public Const AadTargetUrl As String = "https://domain.onmicrosoft.com"
Private Shared Async Function Connect() As Task
End Sub
Private Shared Async Function GetAppTokenAsync() As Task(Of String)
End Function `