1. OnlyFans Authentication
  2. Frontend components

OnlyFans Authentication

Frontend components

You can integrate OFAuth's login directly into your website using our embed library. There are two ways to implement this:

Simple Implementation (Code Snippet)

Add this HTML snippet to your website:

You can integrate OFAuth's login directly into your website using our embed library. There are two ways to implement this:

Simple Implementation (Code Snippet)

Add this HTML snippet to your website:

        <a href="__LOGIN_LINK__" data-ofauth-login data-ofauth-login-theme="light"> Link Account </a>
<script
	src="https://unpkg.com/@ofauth/login-embed@^1.0.0/dist/embed.global.js"
	defer
	data-auto-init
></script>

      

This will create a "Link Account" button that opens an inline login popup when clicked.

Advanced Implementation (JavaScript Library)

For more advanced projects (like React applications), install our library:

        npm install @ofauth/login-embed

      

Then implement it in your code:

        import { OFAuthEmbedLogin } from '@ofauth/login-embed';
import { useEffect } from 'react';

const LinkAccount = () => {
	useEffect(() => {
		OFAuthEmbedLogin.init();
	}, []);

	return (
		<a href="__LOGIN_LINK__" data-ofauth-login data-ofauth-login-theme="light">
			Link Account
		</a>
	);
};

export default LinkAccount;

      
TIP

You can style the trigger element any way you want, just make sure to keep the data-ofauth-login attribute.

Option 2: Direct Redirect

Alternatively, you can redirect users directly to the authentication URL received in Step 1.