• Stars
    star
    230
  • Rank 174,053 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Some oauth examples and implementation.

oauth2orize: oauth2 provider example

This example shows a provider which grants tokens in exchange for codes for

  • The client application
  • A user of the client application

Install

git clone https://github.com/gerges-beshay/oauth2orize-examples.git
pushd oauth2orize-examples
npm install

Usage

Locally

node app.js

Visit http://localhost:3000/login to see the server running locally.

Serverless

Vercel

  1. Download either Vercel Desktop (preferred) or Vercel CLI.
  2. Create a .vercelignore file in the root of the package (where package.json is located) with the following contents:
node_modules
.eslintrc
LICENSE.md
README.md
  1. Create a vercel.json file in the root of the package with the following contents:
{
  "version": 2,
  "builds": [
    {
      "src": "app.js",
      "use": "@now/node-server"
    }
  ],
  "routes": [
    {
      "src": "/(.*)",
      "dest": "app.js"
    }
  ]
}
  1. Execute vercel in the terminal/console. (If the command is not recognized, you might have to restart your computer.)
  2. Once you see the β€œSuccess! Deployment ready” message in the terminal, follow the URL of the deployment provided by the Vercel CLI.

Provider / Consumer Walkthrough

Interacting with this provider directly doesn't showcase it's oauth2 functionality.

  1. Visiting / takes you to a blank page... not too interesting
  2. /login will ask you for credentials.
  • If you login before an oauth request you are taken directly to permission dialog when that request happens
  • Otherwise you will be redirected here and then to the permission dialog
  1. /account will allow you to see your user details

In order to demo what this is actually accomplishing you'll need to run a consumer.

See https://github.com/coolaj86/example-oauth2orize-consumer

API

Below is a mapping of the API in the context of a passport-strategy

  • /dialog/authorize is the authorizationURL.
  • /oauth/token is the tokenURL
  • /api/userinfo is a protected resource that requires user permission
  • /api/clientinfo is a protected resource that requires a token generated from the client's id and secret
  • Usage of scope is not demonstrated in this example.

The standalone usable resources are

  • GET / nothing
  • GET /login lets you login, presented by /dialog/authorize if you haven't logged in
  • POST /login processes the login
  • GET /logout lets you logout
  • GET /account lets your view your user info

And then some internal resources that are of no concern for standalone users or consumers

  • POST /dialog/authorize/decision, processes the allow / deny

More Repositories

1

oauth2orize-openid-examples

JavaScript
17
star
2

ifttt-action

πŸš€ GitHub action that pull Github Issues into Trello ⚑️
JavaScript
8
star
3

sip-ionic

Javascript based SIP client Ionic click to call UI that uses WebRTC and WebSockets to connect to your SIP server.
TypeScript
3
star
4

UI.Quiz

HTML
3
star
5

Express-dialogueflow

JavaScript
2
star
6

Reminder-dialogueflow

JavaScript
2
star
7

IP-date-template

CSS
2
star
8

payment-method

HTML
2
star
9

PracticeExamples

HTML
2
star
10

DesignBootstrap

HTML
2
star
11

Vertical-Nav

HTML
2
star
12

PopUp-Video

2
star
13

Private

2
star
14

Birthday

JavaScript
2
star
15

FileStream

HTML
2
star
16

CircleDirective

JavaScript
2
star
17

jQueryList

HTML
2
star
18

TransparentBootstrap

CSS
1
star
19

VoiceCalculator-dialogueflow

JavaScript
1
star
20

AngularDialogue

JavaScript
1
star
21

directives

JavaScript
1
star
22

paypal

where you can send 100$ payments.
HTML
1
star
23

Facebook

CSS
1
star
24

Dialogues

HTML
1
star
25

BookingAgent-dialogueflow

JavaScript
1
star
26

lunera

JavaScript
1
star
27

Image-sketch

HTML
1
star
28

WorldClock

HTML
1
star
29

Assistant-Design

CSS
1
star
30

HelloWorld-alexa

JavaScript
1
star
31

FaceookNotification-dialogueflow

JavaScript
1
star
32

resume

A simple resume template build using bootstrap framework.
HTML
1
star
33

CurrencyConverter-dialogueflow

JavaScript
1
star
34

Utterances-alexa-sdk

JavaScript
1
star
35

Tags

HTML
1
star
36

AngularDialogue2

JavaScript
1
star
37

HolyQuran

Let you listen to the holy words of Lord through Google Assistant Holy Qur'an app
JavaScript
1
star
38

jQueryFadeIn

HTML
1
star
39

SSML-to-speech

A simple javascript function that converts your desired SSML to natural sound like speech
JavaScript
1
star
40

Todo

JavaScript
1
star
41

AngularDatePicker

JavaScript
1
star
42

UI.Routing

JavaScript
1
star
43

ShopingCart

JavaScript
1
star
44

NestedRouting-ui.router-

JavaScript
1
star
45

Node.js

Demo NodeJS
JavaScript
1
star