conao3 / oauth2-request.el

OAuth2 request package interface.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

https://raw.githubusercontent.com/conao3/files/master/blob/headers/png/oauth2-request.el.png https://img.shields.io/github/license/conao3/oauth2-request.el.svg?style=flat-square https://img.shields.io/github/tag/conao3/oauth2-request.el.svg?style=flat-square https://github.com/conao3/oauth2-request.el/workflows/Main%20workflow/badge.svg https://img.shields.io/codacy/grade/62a36f4f04524d5e8c758440e8071c45.svg?logo=codacy&style=flat-square https://img.shields.io/badge/patreon-become%20a%20patron-orange.svg?logo=patreon&style=flat-square https://img.shields.io/badge/twitter-@conao__3-blue.svg?logo=twitter&style=flat-square https://img.shields.io/badge/chat-on_slack-blue.svg?logo=slack&style=flat-square

Table of Contents

Description

OAuth2 request package interface.

Install

Sample install code using leaf.el.

(leaf oauth2-request :ensure t)

Usage

  1. Get token using oauth2 package.
    (setq token
          (let ((auth-url "https://accounts.google.com/o/oauth2/auth")
                (token-url "https://www.googleapis.com/oauth2/v3/token")
                (client-id "000000000000-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com")
                (client-secret "xxxxxxxxxxxxxxxxxxxxxxxx")
                (scope "https://www.googleapis.com/auth/calendar"))
            (oauth2-auth-and-store auth-url token-url scope client-id client-secret)))
        
  2. Request API using oauth2-request or oauth2-request-synchronously as request package wrapper.
    (oauth2-request token "https://www.googleapis.com/calendar/v3/users/me/calendarList"
      :complete (cl-function
                 (lambda (&key response &allow-other-keys)
                   (with-current-buffer (generate-new-buffer "*oauth2-request*")
                     (insert (pp-to-string response))
                     (newline)
                     (insert (request-response-data response))
                     (display-buffer (current-buffer))))))
        

Customize

Information

Community

Any feedback or suggestions are welcome!

You can use github issues, but you can also use Slack if you want a more casual conversation.

Contribution

We welcome PR!

Require tools for testing

  • keg
    cd ~/
    hub clone conao3/keg .keg
    export PATH="$HOME/.keg/bin:$PATH"
        

Running test

Below operation flow is recommended.

git branch [feature-branch]       # Create branch named [feature-branch]
git checkout [feature-branch]     # Checkout branch named [feature-branch]

# <edit loop>
emacs oauth2-request.el             # Edit something you want

make test                         # Test oauth2-request
git commit -am "brabra"           # Commit (auto-run test before commit)
# </edit loop>

hub fork                          # Create fork at GitHub
git push [user] [feature-branch]  # Push feature-branch to your fork
hub pull-request                  # Create pull-request

Migration

License

General Public License Version 3 (GPLv3)
Copyright (c) Naoya Yamashita - https://conao3.com
https://github.com/conao3/oauth2-request.el/blob/master/LICENSE

Author

Contributors

About

OAuth2 request package interface.

License:GNU General Public License v3.0


Languages

Language:Emacs Lisp 85.1%Language:Makefile 14.9%