oauth1_client 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

An Oauth1 library for Dart developers.

Created from templates made available by Stagehand under a BSD-style license.

Usage #

A simple usage example:

import 'package:oauth1_client/oauth1_client.dart';

main() {
  // TODO: implement
}

1.0.0 #

  • Initial version, created by Stagehand

example/oauth1_client_example.dart

//
// Author: Mertcan Dinler (mertdinlerin@gmail.com)
// oauth1_client_example.dart (c) 2020
//
// This software is released under the MIT License.
// https://raw.githubusercontent.com/mrtcndnlr/oauth1_client/master/LICENSE
//
// Created:  2020-04-17T19:32:46.193Z
// Modified: 2020-04-17T22:44:34.077Z
//

import 'dart:io';
import 'package:http/http.dart' as http;
import 'package:oauth1_client/oauth1_client.dart';

// Twitter Example
Future<http.Client> authorize() async {
  var consumer = ConsumerCredentials('api key', 'api secret');
  var oauth1 = OAuth1Client(consumer);
  oauth1.signatureMethod = Signatures.hmacSha1;
  await oauth1.fetchRequestToken('https://api.twitter.com/oauth/request_token');
  print(oauth1.getAuthorizationUrl('https://api.twitter.com/oauth/authorize'));
  var verifier = stdin.readLineSync();
  oauth1.token = await oauth1.fetchAccessToken(
      'https://api.twitter.com/oauth/access_token', verifier);
  return oauth1.client; //authorized client
}

void main() {
  authorize().then((client) {
    client.post('https://api.twitter.com/1.1/friendships/create.json',
        body: {'screen_name': 'mertcandinler0'});
  });
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  oauth1_client: ^1.0.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:oauth1_client/oauth1_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
37
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:oauth1_client/oauth1_client.dart that imports:
  • package:oauth1_client/src/oauth1_client_base.dart that imports:
  • package:oauth1_client/src/client.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:oauth1_client/oauth1_client.dart that imports:
  • package:oauth1_client/src/oauth1_client_base.dart that imports:
  • package:oauth1_client/src/client.dart that imports:
  • dart:io

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
crypto ^2.1.4 2.1.5
http ^0.12.0+4 0.12.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
convert 2.1.1
http_parser 3.1.4
meta 1.2.2 1.3.0-nullsafety
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
Dev dependencies
pedantic ^1.8.0 1.9.2
test ^1.6.0