damonique-dev / trakt_dart Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
HI Im gettting error ,
Unhandled Exception: Bad state: Cannot set the body fields of a Request with content-type "application/json".
/// Generate new codes to start the device authentication process.
///
/// The device_code and interval will be used later to poll for the access_token.
/// The user_code and verification_url should be presented to the user as mentioned in the flow steps above.
Future<DeviceCodeResponse> generateDeviceCodes({bool? signup}) async {
final url = Uri.https(_manager._baseURL, "oauth/device/code");
final response = await _manager.client.post(url,
headers: {"Content-Type": "application/json"},
body: jsonEncode({"client_id": _manager._clientId});
if (![200, 201, 204].contains(response.statusCode)) {
throw TraktManagerAPIError(
response.statusCode, response.reasonPhrase, response);
}
final jsonResult = jsonDecode(response.body);
return DeviceCodeResponse.fromJsonModel(jsonResult);
}
My Code assume its ok
Future<void> traktAuth() async {
var auth = traktManager.authentication;
final deviceCode = await auth.generateDeviceCodes();
final accessTokenRepsonse =
await auth.getAccessToken(deviceCode.deviceCode);
}
I can't understand how got accesstoken. Ok the generateDeviceCodes but how can I get the accesstoken? ๐ฅ
I cannot seem to figure out the way to use TraktManager.Authentication.authorizeApplication()
. It seems to just be making the request via an http client, with no means for user input or to thereafter retrieve the code.
Any help on this would be greatly appreciated!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.