Coder Social home page Coder Social logo

liboauth's Introduction

liboauth

Cross-platform C http and oauth 2.0 ilbrary

This library is insipred by https://github.com/slugonamission/OAuth2 but aims to add extra missing functionality like access token refresh, state saving, response caching, etc. The project is working and API changes are not extpected though this is not a guarantee.

Note that for the full functionality it is expected you use some other library to extract the code from the redirect uri. It is recommended to use my scheme registering and handling library however, other awesome options exist.

libschemehandler: Lightweight scheme registering and handling library with no extra dependencies (LICENSE MIT)
Ultralight: Lightweight and powerfull embeded browser library (formerly awesomium) (TRIPLE LICENSE)
libmicrohttpd: Lightweight and simple HTTP server library written in ansi C and perfect for embedded systems (LICENSE GPL-3)

Working functionality

  • Syncronous API requests with request caching.
  • Compatibility with my URI scheme handler.
  • Supports all major API request types (PUT, PATCH, POST, GET, DELETE...)
  • State saving of "tokens" and configuration variables (simple .ini file)
  • Auto refresh "access token" with zero overhead for the user.
  • Cross-compatibility with Windows/Apple/Linux
  • The response code and content type (as well as the response data) are returned.
  • Custom cache data structure with cache saving between sessions.
  • Async request support for the same oauth module with the same client_id.
  • Optional per request configurations (cached, async and authed)
  • Handling on auth callback different than application/json (AKA XML)

Contributing

Any contribution is welcome and should be done through a pull request. Currently help is mostly needed with documentation and general bugfixing. Also standarization and cleanup of libutils would be nice. Any comments on how to make the project faster and/or cleaner are also very welcome.

Credit

Credit goes to:
Rafa Garcia from https://github.com/rafagafe/tiny-json
Ozan Tezcan from https://github.com/tezc/sc
Rodion Efremov from https://github.com/coderodde/coderodde.c.utils
for their amazing libraries.

liboauth's People

Contributors

germaniuss avatar germanowo avatar

Stargazers

 avatar

liboauth's Issues

Fix cached response memory leak

A copy of the response should be returned instead of the response (this way it can be always be freed without problem) then when saving another value to cache the old response should be freed.

Hunt down all memory leaks

A lot of potential memory leaks exist especially with char* allocations. Also response_data and request_data caching and queuing respectively should be done with a struct and not with a struct pointer to avoid potential memory problems and overall overhead when handling cached responses.

Rework the async feature

Separate the REQUEST_ASYNC option into REQUEST_ASYNC and REQUEST_QUEUE. Make request async work with callbacks. A request skip should be implemented to know if the request should skip requests waiting for execution.

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.