Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/xd2sketch/react-oauth-popup

⚛️ React component for doing oAuth popups
https://github.com/xd2sketch/react-oauth-popup

nextjs oauth popup react

Last synced: about 22 hours ago
JSON representation

⚛️ React component for doing oAuth popups

Awesome Lists containing this project

README

        

## react-oauth-popup

![Node.js CI](https://github.com/kgoedecke/react-oauth-popup/workflows/Node.js%20CI/badge.svg)

OAuth-Popups are some pretty nasty jams that don't fit well in React. This component allows you declare an oauth-popup inline with your components and handles the nasty window navigation for you.

Please note: This component currently only supports OAuth Authorization Code grant type (see: [OAuth2 Grant Types](https://oauth.net/2/grant-types/) [OAuth2 Simplified](https://aaronparecki.com/oauth-2-simplified/#authorization))

### Install

NPM:
```bash
npm install react-oauth-popup --save
```

Yarn:
```bash
yarn add react-oauth-popup
```

### Props

* **url** - the url of the oauth navigation screen (instagram/facebook/etc.)
* **onCode** - called when the user has successfully authenticated with the oauth code
* **onClose** - called when the popup will be closed
* **width** - width of the popup window (optional)
* **height** - height of the popup window (optional)
* **title** - title of the popup window (optional)
### Example

```jsx
const onCode = (code, params) => {
console.log("wooooo a code", code);
console.log("alright! the URLSearchParams interface from the popup url", params);
}
const onClose = () => console.log("closed!");

function Comp() {
return (

Click me to open a Popup


);
}
```

### License

MIT