简体   繁体   中英

C# Windows Forms Spotify API User Authorization

I'm trying to authorize a spotify user in my windows forms application. I am able to make a GET call to the web API , and I get a response back that is HTML . When loaded into the browser, this HTML is a login page, but my question is two parts.

1) What would be the best way to display this login page. Obviously if I could launch the browser and have it return the authorization code somehow, that would be best, which brings me to my second question.

2) How would I get the authorization code from the browser when I launch the login screen? I can't see a way that my forms application would be able to receive any information after the login screen is launched. Sorry if this seems obvious.

I figured it out, the URL I was using was not meant to be requested from, but to have the user navigate to in their browser. I basically just put the link in my application as a button and it would launch in chrome. Once the user logs in, I used http://httpbin.org/get to display the authentication code and just copied the code into my app as a temporary fix. Obviously this is not ready for release, and I am still working out how to get the code from the redirect url to my application, but it's a step in the right direction!

1) You can display a web browser inside your form to do the login part.
2) Browsers like Chrome can't return values. You could look at the data sent / received from your browser and search for an authentication token or something like that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM