Git Product home page Git Product logo

myconsciousness / authorization-header Goto Github PK

View Code? Open in Web Editor NEW
3.0 1.0 0.0 43 KB

AuthorizationHeader is an open-sourced Dart library. With AuthorizationHeader, you can easily manage authorization header on your application.

Home Page: https://pub.dev/packages/authorization_header

License: BSD 3-Clause "New" or "Revised" License

Dart 100.00%
http authrization header authorization-header dart flutter library pubdev

authorization-header's Introduction

A most easily usable authorization header management library in Dart!

pub package codecov Analyzer Test

1. About

AuthorizationHeader is an open-sourced Dart library.
With AuthorizationHeader, you can easily manage authorization header on your application.

The AuthorizationHeader library provides a common features for generating authorization header for use with Basic or Bearer authorization. Proxy-Authorization for proxies is also supported.

By using the AuthorizationHeader library, there is no need for redundant implementation or research to generate the authorization header anymore!

1.1. Supported

1.1.1. Authorization Header

Name
Authorization
Proxy-Authorization

1.1.2. Authorization Type

Name RFC
Basic RFC 7617
Bearer RFC 6750

1.2. Introduction

1.2.1. Install Library

With Dart:

 dart pub add authorization_header

With Flutter:

 flutter pub add authorization_header

1.2.2. Import It

import 'package:authorization_header/authorization_header.dart';

1.2.3. Use AuthorizationHeader

AuthorizationHeader can be used in conjunction with the http package as follows.

import 'package:authorization_header/authorization_header.dart';
import 'package:http/http.dart' as http;

void main() async {
  /// You can switch between Default and Proxy in the constructor.
  final authHeader = Auth.of().bearer(token: 'test_token');
  final proxyAuthHeader = Auth.ofProxy().bearer(token: 'test_token');

  print(authHeader); // -> name: Authorization, value: Bearer test
  print(proxyAuthHeader); // -> name: Proxy-Authorization, value: Bearer test

  await http.post(
    Uri.parse('https://test.com'),
    headers: {
      authHeader.name: authHeader.value,
      proxyAuthHeader.name: proxyAuthHeader.value,
    },
  );
}

1.3. License

Copyright (c) 2021, Kato Shinya. All rights reserved.
Use of this source code is governed by a
BSD-style license that can be found in the LICENSE file.

1.4. More Information

AuthorizationHeader was designed and implemented by Kato Shinya.

authorization-header's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.