1
votes

Please let me elaborate what I am trying to do.

What I want to do?

I am creating a cocoa application that uploads an user files to user's Onedrive and in order to do that I am requesting for an Access token by launching the access token URL in Safari.

https://login.live.com/oauth20_authorize.srf?client_id={APPLICATIONID}&scope=wl.signin+wl.offline_access+onedrive.readwrite&response_type=token&redirect_uri=https://login.live.com/oauth20_desktop.srf

Problem

Now the problem is how will I retrieve the access token from safari to my cocoa app?

In short: How to get one drive access token in Cocoa Application?

Please help. Many thanks

1

1 Answers

0
votes

In order get access token on Local application you will need to follow given below steps:

  1. Login to dev.onedrive.com and check YES on Mobile or desktop client app option enter image description here
  2. Take a browser control in you application and load the access token verify page
  3. Add a URL change event for browser control
  4. Whenever you get a url starting with https://login.live.com/oauth20_desktop.srf that has a # and access_token variable than it means you application has received the access from a user.
  5. In case user clicks on NO(not providing access) then you will get a url starting with https://login.live.com/oauth20_desktop.srf?lc=1033#error=access_denied

Note: The idea is very simple. You will need to monitor URL changes and do the task accordingly.

P.S: Keep in mind that the redirect URL for local apps will be https://login.live.com/oauth20_desktop.srf