steam_login 1.0.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 53

A library for Dart developers.

Get Started #

Add your library to pubspec.yaml

depedencies:
    steam_login: ^1.0.0

and import it in your code and initialize the Object using the current HttpRequest.

import 'package:steam_login/steam_login.dart';

OpenId openId = OpenId(request);

See example/steam_login_example.dart for a full example!

Features and bugs #

Please file feature requests and bugs at the issue tracker.

1.0.0 #

  • Initial version, created by Stagehand

example/steam_login_example.dart

import 'dart:io';

import 'package:steam_login/steam_login.dart';

Future<void> main() async {
  // Bind the HttpServer.
  var server = await HttpServer.bind(
    InternetAddress.loopbackIPv4,
    80,
  );

  // Start listening for HttpRequests.
  server.listen((request) async {
    //Check if the path is '/login'
    if (request.uri.path == '/login') {

      // Create OpenId instance with the current request.
      OpenId openId = OpenId(request);

      // Switch the mode
      switch (openId.mode) {
        // No mode is set
        case '':
          {
            //Redirect the user to the authUrl.
            request.response
              ..redirect(openId.authUrl())
              ..close();
            break;
          }
          // Authentication failed/cancelled.
        case 'cancel':
          {
            request.response
              ..write('Auth cancelled')
              ..close();
            break;
          }
          // Usually mode = 'id_res'.
        default:
          {
            // Validate the authentication and the the steamid64.
            String steamId = await openId.validate();

            // Save the steamid into the session.
            request.session['steamid'] = steamId;

            // Redirect the user.
            request.response
              ..redirect(Uri.parse('http://localhost'))
              ..close();
          }
      }
    } else {
      // Check if the user is already logged
      if (request.session['steamid'] == null) {
        request.response.write('Go to /login in order to log in!');
      } else {
        // If he's logged in display his steam display name.
        // Get the steamapi key here: https://steamcommunity.com/dev/apikey
        Map<String, dynamic> summaries = await GetPlayerSummaries(request.session['steamid'], 'yoursteamapikey');
        request.response.write(
            'Thanks for logging in: ${summaries['personaname']}');
      }
      request.response.close();
    }
  });
}

Use this package as a library

1. Depend on it

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


dependencies:
  steam_login: ^1.0.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:steam_login/steam_login.dart';
  
Version Uploaded Documentation Archive
1.0.1 Jan 1, 2019 Go to the documentation of steam_login 1.0.1 Download steam_login 1.0.1 archive
1.0.0 Jan 1, 2019 Go to the documentation of steam_login 1.0.0 Download steam_login 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
6
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
53
Learn more about scoring.

We analyzed this package on May 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.3.0
  • pana: 0.12.15

Platforms

Detected platforms: Flutter, other

Primary library: package:steam_login/steam_login.dart with components: io.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
http ^0.12.0 0.12.0+2
Transitive dependencies
async 2.2.0
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
meta 1.1.7
path 1.6.2
pedantic 1.7.0
source_span 1.5.5
string_scanner 1.0.4
term_glyph 1.1.0
typed_data 1.1.6