@Blag it will work for html/vanila js also right ?
but when i tried to bypass it through that it send me this error
here is my code for ref:
<div class="grid h-full place-items-center">
<!-- Add the Nylas Scheduler Editor component -->
<nylas-scheduler-editor
/>
</div>
<!-- Configure the Nylas Scheduler Editor component -->
<script type="module">
class CustomIdentityRequestWrapper {
constructor(accessToken) {
this.accessToken = accessToken;
}
async request(args) {
try {
console.log('args', args);
console.log('args method',args.method)
const response = await fetch(`https://api.eu.nylas.com/v3/grants/me/${args.path}`, {
mode:"no-cors",
method: args.method,
body: JSON.stringify(args.body),
headers: {
...args.headers,
'Authorization': `Bearer ${this.accessToken}`,
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
},
});
if (!response.ok) {
console.error(`Error: ${response.status} ${response.statusText}`);
return { error: `Error: ${response.status} ${response.statusText}` };
}
const data = await response.json();
return [data, null];
} catch (error) {
console.error('Fetch error:', error);
return { error: "Error" };
}
}
async currentUser() {
return {
id: 'eyJhbG................................',
email: 'dhruv...............',
name: 'dhruv',
provider: 'google',
};
}
async setDefaultAuthArgs(authArgs) {
return authArgs;
}
async authenticationUrl() {
return 'http://localhost:3000/scheduler-editor';
}
}
// const schedulerEditor = document.querySelector("nylas-scheduler-editor");
// schedulerEditor.schedulerPreviewLink = `${window.location.origin}/?config_id={config.id}`;
const accessToken = 'BI6A3fKRLxJNEzHXXixvMExqrYRMSEKKHhSpvbWoiJytFm07bvCObTc2r1Tc2305_kpL_9_9.......................................................................'
// Create an instance of the CustomIdentityRequestWrapper class defined above
const schedulerEditor = document.querySelector("nylas-scheduler-editor");
const nylasApiRequest = new CustomIdentityRequestWrapper(accessToken)
schedulerEditor.nylasApiRequest = nylasApiRequest
schedulerEditor.schedulerPreviewLink = `${window.location.origin}/?config_id={config.id}`; // Replace with the URL of the page where you want to display the scheduler
schedulerEditor.configurationId = "config.id"; // Replace with the configuration ID you want to edit
// schedulerEditor.nylasSessionsConfig = {
// clientId: "91d00.......................................", // Replace with your Nylas client ID from nylas dashboard
// redirectUri: `${window.location.origin}/scheduler-editor`, // Replace with the redirect URI you set in the Nylas dashboard
// domain: "https://api.eu.nylas.com/v3", // or 'https://api.us.nylas.com/v3' for US data center
// hosted: true,
// accessType: "offline",
// };
schedulerEditor.defaultSchedulerConfigState = {
selectedConfiguration: {
requires_session_auth: false, // creates public configuration which does not require session tokens
scheduler: {
// organizer_confirmation_url: `${window.location.origin}/confirmation/:booking_ref`,
cancellation_url: `${window.location.origin}/cancel/:booking_ref`,
rescheduling_url: `${window.location.origin}/reschedule/:booking_ref`,
// confirmation_redirect_url: `${window.location.origin}/booking-confirmed`
},
},
};
in above code i have used hard coded values as of now for testing auth but it didn’t worked out do i missing something or is there any mistake from my side ??