Socket
Socket
Sign inDemoInstall

byu-oauth

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    byu-oauth

Handles the OAuth2.0 flow for BYU APIs


Version published
Maintainers
1
Created

Readme

Source

byu-oauth

Handles the OAuth2.0 flow for BYU APIs

Examples

var OAuth = require("byu-oauth");

OAuth.getAccessToken(OAuth.grant_type.AUTHORIZATION_CODE, {
  client_id: /*client id*/,
  client_secret: /*client secret*/,
  code: /*authorization code*/,
  redirect_uri: /*redirect uri--where WSO2 redirected user after user validated your app*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.getAccessToken(OAuth.grant_type.CLIENT_CREDENTIALS, {
  client_id: /*client id*/,
  client_secret: /*client secret*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.getAccessToken(OAuth.grant_type.REFRESH_TOKEN, {
  client_id: /*client id*/,
  client_secret: /*client secret*/
  refresh_token: /*refresh token*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.getAccessToken(OAuth.grant_type.RESOURCE_OWNER, {
  client_id: /*client id*/,
  client_secret: /*client secret*/,
  password: /*password for NetID*/,
  username: /*NetID*/
}).then(function (token) {
  
  //  use token here
  console.log(token);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.generateAuthorizationURL(OAuth.grant_type.AUTHORIZATION_CODE, /*client id*/, /*redirect uri*/)
.then(function (authorization_url) {
  
  //  use authorization URL here
  console.log(authorization_url);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

OAuth.generateAuthorizationURL(OAuth.grant_type.IMPLICIT, /*client id*/, /*redirect uri*/)
.then(function (authorization_url) {
  
  //  use authorization URL here
  console.log(authorization_url);

}).catch(function (err) {
  
  //  handle error here
  console.error(err);
});

Keywords

FAQs

Last updated on 06 Mar 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc