const API_URL = 'https://your-worker-url.workers.dev';
// Register a new user
fetch(API_URL, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
operation: 'register',
name: 'John Doe',
email: '[email protected]',
doSend: true,
}),
})
.then((response) => response.json())
.then((data) => console.log(data));
// Confirm registration
fetch(API_URL, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
operation: 'register2',
code: 'ABC123',
email: '[email protected]',
}),
})
.then((response) => response.json())
.then((data) => console.log(data));
// Login
fetch(API_URL, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
operation: 'login',
email: '[email protected]',
doSend: true,
}),
})
.then((response) => response.json())
.then((data) => console.log(data));
// Finish login
fetch(API_URL, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
operation: 'login2',
code: 'XYZ789',
email: '[email protected]',
}),
})
.then((response) => response.json())
.then((data) => console.log(data));
// Verify JWT
fetch(API_URL, {
method: 'PUT',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
operation: 'jwt',
token: 'your-jwt-token-here',
}),
})
.then((response) => response.json())
.then((data) => console.log(data));
-
Notifications
You must be signed in to change notification settings - Fork 0
alselawi/auth1
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published