Socket
Socket
Sign inDemoInstall

@pandolink/utils

Package Overview
Dependencies
16
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @pandolink/utils

useIDC is a client side SDK that establishes communication between Open ID Connect Identity Server. This library is designed for Web Apps and Node.js applications. useOIDC adheres to PCKE extension to OAuth which facilitates secure authorization code in p


Version published
Weekly downloads
2
increased by100%
Maintainers
3
Created
Weekly downloads
 

Readme

Source

USE OIDC

useIDC is a client side SDK that establishes communication between Open ID Connect Identity Server. This library is designed for Web Apps and Node.js applications. useOIDC adheres to PCKE extension to OAuth which facilitates secure authorization code in public clients.

Import useOIDC to an existing project

yarn add @pandolink/utils

or

npm install @pandolink/utils
    // Add the following env to existing react project
    // It should have a REACT_APP_ prefix
    REACT_APP_LOGIN_URI = 'https://login.staging.yourcompany.com',
    REACT_APP_REDIRECT_URI = 'https://yourcompany.com/sample',
    REACT_APP_SCOPE = 'xyz',
    REACT_APP_CLIENT_SECRET = '123xyz',
    REACT_APP_CLIENT_ID = '1234',
// Top Level Component
import { useOIDC } from '@pandolink/utils';

const App: React.FC = () => {
    const [user] = useOIDC()
    return (
        <Route to='/admin'>
            {
                user.isAuthenticated && </Admin>
            }
        </Route>
    );

}

View flow diagram here

useOIDC performs authorization, authentication and request an access token for your react application.

1: AUTHORIZATION

It will first check if you have an access token. If access token does not exist then it will start the Open Id Connection flow.

2: REDIRECT

Your application will be redirected to the url you provided in the REACT_APP_LOGIN_URI env. If login credentials is correct then you'll be authorize in a code will be return in the url.

3: GET ACCESS TOKEN

To request for an access token, that code will then be taken by useOIDC and use it to authenticate you. If authenticated the Open ID Identity server will return an acceess token.

Use that access token to to request for data from the GRPC server.

FAQs

Last updated on 13 Apr 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