Jump to content

background threads


thecubical

Recommended Posts

thecubical

I'm looking to help update the currently broken trakt plugin.

 

They've switched to OAuth authentication and now you need to call them to generate a device id, show that device id to the user and then wait for the user to go to their site and authorise the device.

 

I'm looking at replacing the code to use TraktApiSharp (https://henrikfroehling.github.io/TraktApiSharp/guide/) for all of this.

 

So bascially call 

 

TraktDevice device = await client.DeviceAuth.GenerateDeviceAsync();
 
Show the user the device.usercode and ask them to go to device.VerificationUrl
 
and then possibly in a background thread or something like that poll for the authorisation being completed like so
 
TraktAuthorization authorization = await client.DeviceAuth.PollForAuthorizationAsync();
 
Whats the best way to implement this polling, can I just spawn a new thread/task directly in the plugin or do I need to do something with a manually triggered scheduled task?
Link to comment
Share on other sites

Actually see the pull request that was submitted. Maybe you can help test that out and verify it. I will be testing it shortly. Thanks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...