Last updated 4 months ago

Use Mason Login to build a quick component for users to authenticate with your identity provider.

Using Email and Password

By default, Mason Login starts with a single form containing email and password fields. See the Sending Data section to customize this form, and see the required request and response payloads.

Storing Authentication State

The Mason Login feature does not store authentication state, but leaves it to the developer to decide how to implement it. Upon receiving a 2xx response code from the authentication server, it will call didReceiveData with the response body. At this point, you may take the appropriate action to set the authentication state.


import React from 'react';
import { Login } from 'mason-library';
class MyLogin extends React.Component {
render() {
return <Login id="YOUR_COMPONENT_ID" didReceiveData={(data) => {
const { user } = data;
localStorage.setItem('id_token', user.token);
// always return the data from your handlers
return data;