AnsweredAssumed Answered

How to get access token for currently logged in user in SharePoint hosted app/C# application

Question asked by Muzammil Mohammed on Aug 7, 2017
Latest reply on Sep 28, 2017 by rogrant@nmsu.edu

According to the documentation mentioned for OAuth2, we are trying to authenticate the current logged in user and try to get the courses and display them in SharePoint. To do this we have followed below things:

  1. Single sign-on was setup on canvas cloud. we have added LDAP settings and working fine.
  2. Created a new developer key under Admin--> Developer keys section.
  3. We have constructed the url like https://<canvasurl>/login/oauth2/auth?client_id=<clientid>&redirect_uri=<redirecturl>&response_type=code&client_secret=<client_secreet>
  4. We are calling this url in our C# file. But after success it is returning the https://<<.cc>.test.instructure.com/login/ldap url.
  5. Same thing happening with JavaScript as well. Same behavior if I type the url in the browser also (it is asking me to login to canvas site).
  6. Above request is GET request.

 

Questions:

  1. The URL that we are trying to hit is proper or not?
  2. Why I am getting this login page as response?
  3. How to proceed further from this login page?
  4. Response should contain access token which will be useful to get the information. Is there any other ways to get the required information/access token?

Outcomes