Hi, I’ve tried authenticate using this guide: 8base React SDK Authentication - 8base Documentation
When I use @8base/auth package for using Auth.createClient function I have the next issue:
I don’t know what’s the problem, I checked the Auth class and did not find the issue.
Thanks for helping!
Hello!
Thanks for reaching out!
We’ll answer you as soon as possible.
Lada Kokotova | Technical Support Engineer
Could you send your code, please? It will help me find a more personalized solution to your issue.
Lada Kokotova | Technical Support Engineer
Of course, this is my code
This is my configuration:
import { Auth } from '@8base/auth';
const options = { strategy: '8base-auth', subscribable: true }
const clientOptions = {
/* Authentication profile client ID */
clientId: import.meta.env.CLIENT_ID,
/* Authentication profile domain */
domain: import.meta.env.DOMAIN,
/* Permitted callback url */
redirectUri: `${window.location.href}/${import.meta.env.REDIRECT_URI}/${window.location.href}`,
/* Permitted logout redirect url */
logoutRedirectUri: `${window.location.href}/${import.meta.env.REDIRECT_URI}`,
}
export const authClient = Auth.createClient(options, clientOptions);
And I called it here:
import ReactDOM from 'react-dom'
import './index.css'
import App from './App'
import { AppProvider } from '@8base/react-sdk'
import { authClient } from './services/authClient'
ReactDOM.render(
<AppProvider uri={import.meta.env.END_POINT} authClient={authClient}>
{({ loading }) => {
if (loading) {
return <p>Please wait...</p>;
}
return <App />;
}}
</AppProvider>,
document.getElementById('root')
)
We’ll check what’s wrong. I’ll let you know soon.
Lada Kokotova | Technical Support Engineer
Hello!
You used the wrong strategy. The strategy name 8base-auth
is not valid, I think that you meant web_8base
import { Auth, AUTH_STRATEGIES } from '@8base/auth';
export const authClient = Auth.createClient(
{
strategy: AUTH_STRATEGIES.WEB_8BASE,
subscribable: true,
},
{
clientId: import.meta.env.CLIENT_ID,
domain: import.meta.env.DOMAIN,
redirectUri: `${window.location.href}/${import.meta.env.REDIRECT_URI}/${window.location.href}`,
logoutRedirectUri: `${window.location.href}/${import.meta.env.REDIRECT_URI}`,
}
);
Lada Kokotova | Technical Support Engineer
1 Like