Auth
An Appstitch library for passwordless authentication
Install
npm i @appstitch/authappstitch_auth: 1.0.0Install Peer Dependencies
npm install @appstitch/coreappstitch_core: ^2.0.0Usage
Sign Up
auth.signUp({email : "[email protected]"})
.then(result => {
if(result.success)
{
// A code has been successfully sent to the email address
// Ready to Confirm User (See below)
}
})
final opts = AuthOptions(email: "[email protected]");
final result = await auth.signUp(opts);
if(result.success!)
{
// A code has been successfully sent to the email address
// Ready to Confirm User (See below)
}
else
{
// handle error
}Sign In
auth.signIn({email : "[email protected]"})
.then(result => {
if(result.success)
{
// A code has been successfully sent to the email address
// Ready to Confirm User (See below)
}
})final opts = AuthOptions(email: "[email protected]");
final result = await auth.signUp(opts);
if(result.success!)
{
// A code has been successfully sent to the email address
// Ready to Confirm User (See below)
}
else
{
// handle error
}Confirm User
auth.confirmUser({code : "ABC123")
.then(result => {
if(result.success)
{
// Token that can be used with other Appstitch Integrations
const authToken = result.authToken;
// User ID
const id = result.id
}
})final opts = AuthOptions(code: "ABC123");
final result = await auth.signUp(opts);
if(result.success!)
{
// User ID that can be stored in your database
const id = result.id!;
// Token that can be used with other Appstitch Integrations
const authToken = result.authToken!;
}
else
{
// handle error
}Last updated
Was this helpful?