Socket
Socket
Sign inDemoInstall

@lighthouseapps/oauth2-client

Package Overview
Dependencies
0
Maintainers
6
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @lighthouseapps/oauth2-client

> Javascript oauth2 client


Version published
Weekly downloads
8
increased by300%
Maintainers
6
Install size
8.40 kB
Created
Weekly downloads
 

Readme

Source

oauth2-client

Javascript oauth2 client

Usage

import OAuth2Client from './lib/OAuth2Client';
import AsyncStorage from '@react-native-community/async-storage';

class ReactNativeOAuth2Model {
  constructor(navigation) {
    this.navigation = navigation;
  }

  createCode() {}

  createCodeToken() {}

  createPasswordToken() {}

  refreshToken() {}

  signout() {}
}

class ReactNativeOAuth2 {
  initialize(model, options = {}) {
    this.client = new OAuth2Client(model, {
      ...options,
      Storage: AsyncStorage
    });
  }

  getToken() {
    return this.client.getToken();
  }

  signinWithPassword() {
    return this.client.signinWithPassword(...arguments);
  }

  signinWithAuthorizationCode() {
    return this.client.signinWithAuthorizationCode(...arguments);
  }

  signout() {
    return this.client.signout();
  }
}

class WebOAuth2 {
  initialize(model, options = {}) {
    this.client = new OAuth2Client(model, {
      ...options,
      Storage: localStorage
    });
  }

  getToken() {
    return this.client.getToken();
  }

  signinWithPassword() {
    return this.client.signinWithPassword(...arguments);
  }

  signinWithAuthorizationCode() {
    return this.client.signinWithAuthorizationCode(...arguments);
  }

  signout() {
    return this.client.signout();
  }
}

const oauth2 = new ReactNativeOAuth2();

oauth2.initialize(new ReactNativeOAuth2Model(this.props.navigation));

FAQs

Last updated on 10 Feb 2022

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