Manifold OAuth Widget - Plain JS
Install
> yarn add @manifoldxyz/oauth-widget-js
Auth Types
Implicit Grant
This flow type is meant for purely frontend applications. Your user will be directed to a login page, and once they sign the login, they will be redirected to your redirectUri
with the query param ?token=
, which is an access token to call the Manifold Data API resources.
import { ManifoldOAuthLink } from '@manifoldxyz/oauth-widget-js'
<ManifoldOAuthLink
clientId="abcd"
grantType="token"
redirectUri="https://developers.manifoldxyz.dev/"
/>
Authorization Code Grant
This login flow is meant for when you have a backend as well as a frontend, and you can keep your Client Secret safe on the backend. Here, your user will be directed to a login page and once they sign the login, will be redirected to your redirectUri
with the query param of ?code=
, which is an authorization code you can use (one-time) to get an access token.
You will want to pass this code to your backend, and use the backend to call our OAuth server to get a token based on the code, your clientId, and your clientSecret.
import { ManifoldOAuthLink } from '@manifoldxyz/oauth-widget-js'
<ManifoldOAuthLink
clientId="abcd"
grantType="code"
redirectUri="https://developers.manifoldxyz.dev/"
/>