cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Adventurer II

OAuth Complete - LocalHost Test

Jump to solution

Hi Community,

I'm new to this dev world and i'm amazed with all the possibilities that canvas has to offer to developers. But, before that, i need to learn how to authenticate my localhost website to use api calls, right? 

If i'm not going wrong, i need to work with Oauth login:

GET https://<canvas-install-url>/login/oauth2/auth?client_id=XXX&response_type=code&redirect_uri=urlRedi...

<form method="get" action="https://xxx.instructure.com/login/oauth2/auth?client_id=yyy&response_type=code&redirect_uri=https://...">

  <input type="submit" value="submit">
</form>

So, lets say if i run this locally, inserting my client Id (that i generated on my canvas enviroment, developer key), this get call should work? (know that is not a good way of doing it, but just need to understand if this is a way to do it or not).

I'm receiving this:

while(1);{"error":"invalid_client","error_description":"unknown client"}

If this should work, what can be done to achieve it that i'm missing? (since it's returning this error message). 

If this should not work, where i can learn a little bit on how to authenticate a localhost webpage to canvas. 

Edit: I appended this html Get FORM to a actual page inside my canvas Application from the javascript theme insert and the result was the same. 

Edit2: Got it working!

Just used this:

<input type="button" name="getToken" value="Get Token" onclick="location.replace('https://<canvas_url>/login/oauth2/auth?client_id=id&amp;response_type=code&amp;redirect_uri=<uri_urL>&state=inv');">


Thanks for your support! 

Regards,

Alexandre "novice" Schneider

1 Solution

Accepted Solutions
Highlighted

Hi Robbie, 

Actually i switched the project to a .Net Core MVC Entity Framework and all is working just fine. 

Regards!

View solution in original post

3 Replies
Highlighted
Community Coach
Community Coach

alexandre.schneider@centrouniversitariofam.com, greetings! Due to the technical nature of this question, it has been shared with the Canvas Developers‌ group in the Community. 

Kona

Highlighted
Community Coach
Community Coach

alexandre.schneider@centrouniversitariofam.com,

Were you able to find an answer to your question? I am going to go ahead and mark this question as answered because there hasn't been any more activity in a while so I assume that you have the information that you need. If you still have a question about this or if you have information that you would like to share with the community, by all means, please do come back and leave a comment.  Also, if this question has been answered by one of the previous replies, please feel free to mark that answer as correct.

 

Robbie

Highlighted

Hi Robbie, 

Actually i switched the project to a .Net Core MVC Entity Framework and all is working just fine. 

Regards!

View solution in original post

Top Kudoed Authors
Labels