-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1263 from appwrite/day-4-init
Day 4 init
- Loading branch information
Showing
12 changed files
with
353 additions
and
0 deletions.
There are no files selected for viewing
95 changes: 95 additions & 0 deletions
95
src/routes/blog/post/announcing-mock-numbers-session-alerts/+page.markdoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
--- | ||
layout: post | ||
title: "Introducing mock numbers and session alerts in Auth" | ||
description: In response to popular demand, we're thrilled to announce two significant improvements to Appwrite Auth. | ||
date: 2024-08-23 | ||
cover: /images/blog/init-day4/cover.png | ||
timeToRead: 4 | ||
author: luke-silver | ||
category: product | ||
featured: false | ||
--- | ||
We’ve listened to your feedback and are introducing two new features designed to simplify phone authentication testing and bolster account security. | ||
|
||
Mock numbers allow you to set up a list of phone numbers with a predefined, static verification code, which is perfect for app reviews and testing. Session alerts will help your users maintain their account security. | ||
|
||
Let’s dive in! | ||
|
||
# Mock numbers | ||
|
||
Mock numbers allow you to configure a list of phone numbers that can sign in with specific, unchanging verification codes. No SMS is actually sent, making this perfect for testing environments and app review scenarios. | ||
|
||
Ready to implement mock numbers in your project? Here's how to get started: | ||
|
||
First, configure your mock numbers. You can do it with the Appwrite console (go to your project, and then **Auth > Security**) | ||
|
||
![Mock-numbers](/images/blog/init-day4/1.png) | ||
Or handle it with the Appwrite SDK: | ||
|
||
```dart | ||
import 'package:dart_appwrite/dart_appwrite.dart'; | ||
|
||
Client client = Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') | ||
.setProject('<YOUR_PROJECT_ID>') | ||
.setKey('<YOUR_API_KEY>'); | ||
|
||
Projects projects = Projects(client); | ||
|
||
// Update your mock numbers programmatically | ||
await projects.updateMockNumbers([ | ||
{ | ||
"phone": "+1655513432", | ||
"otp": "123456" | ||
} | ||
]); | ||
``` | ||
|
||
Now, in your Flutter app, you can use these mock numbers for authentication: | ||
|
||
```dart | ||
import 'package:appwrite/appwrite.dart'; | ||
|
||
Client client = Client() | ||
.setEndpoint('https://cloud.appwrite.io/v1') | ||
.setProject('<YOUR_PROJECT_ID>'); | ||
|
||
Account account = Account(client); | ||
|
||
// Create account with phone number | ||
final userId = ID.unique(); | ||
await account.createPhoneToken( | ||
userId: userId, | ||
phone: '+1655513432', | ||
); | ||
|
||
// Login with phone number and OTP | ||
final session = await account.createSessionWithPhone( | ||
userId: userId, | ||
secret: '123456', | ||
); | ||
``` | ||
|
||
The mock numbers feature will be available for Pro users in 1.6. | ||
|
||
# Session alerts | ||
|
||
When you sign into your Appwrite Cloud account, you will receive an email telling you about the sign-in, including details about the session. | ||
|
||
![Email-session-alert](/images/blog/init-day4/2.png) | ||
|
||
This is a security feature that allows you to quickly secure your account if compromised. It’s enabled by default for Cloud, and you can enable it for your Appwrite project in the **Auth > Security** menu: | ||
|
||
![Session-alert](/images/blog/init-day4/3.png) | ||
|
||
# Get started | ||
|
||
Mock numbers help you streamline testing and development by providing a controlled environment for phone authentication. By using predefined phone numbers and verification codes, you can rapidly iterate your apps without relying on real phone numbers. | ||
|
||
Session alerts empower users to protect their accounts and help prevent unauthorized access. | ||
|
||
If you’d like to try these features out in your application, here are a few resources to get you started: | ||
|
||
- [Read the mock numbers documentation](/docs/products/auth/phone-sms) | ||
- [Join our Discord community](https://discord.gg/appwrite) | ||
- [Learn about Appwrite Init](https://www.appwrite.io/init) |
164 changes: 164 additions & 0 deletions
164
src/routes/blog/post/mock-numbers-best-practices/+page.markdoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
--- | ||
layout: post | ||
title: "Mock numbers for phone sign-in: Use cases and best practices" | ||
description: Dive deeper into use cases, best practices and examples of mock numbers in action. | ||
date: 2024-08-23 | ||
cover: /images/blog/mock-numbers-use-cases/cover.png | ||
timeToRead: 5 | ||
author: ebenezer-don | ||
category: product | ||
featured: false | ||
--- | ||
If you've ever struggled with testing phone sign-in flows without incurring the cost of real SMS messages or waiting for delivery delays, you'll appreciate the convenience of mock numbers. In Appwrite, mock numbers are predefined phone numbers and verification codes that you can use to simulate phone sign-in scenarios during development and testing. | ||
|
||
In this guide, we'll explore the use cases, setup, and best practices for using mock numbers in your development and testing processes. | ||
|
||
# Use cases for mock numbers | ||
|
||
Mock numbers offer several benefits for developers, testers, and other stakeholders involved in the app development lifecycle. Here are some common use cases for using mock numbers in your projects: | ||
|
||
**1. Development and debugging** | ||
|
||
Mock numbers make it easier to develop and debug phone authentication flows. You can quickly test authentication scenarios without waiting for SMS delivery or using real phone numbers. | ||
|
||
**2. Quality assurance testing** | ||
|
||
QA teams can consistently test various authentication scenarios with mock numbers, including edge cases, to ensure the app behaves correctly under different conditions. | ||
|
||
**3. App Store review process** | ||
|
||
Authentication flow testing might be required when submitting apps to platforms like Google Play and the Apple App Store. Mock numbers allow reviewers to test these features without using personal phone numbers. | ||
|
||
**4. Demonstrations and demos** | ||
|
||
Mock numbers simplify the demonstration of phone sign-in functionality during presentations. You can showcase the complete authentication flow without delays or interruptions caused by SMS delivery. | ||
|
||
# Setting up mock numbers in Appwrite | ||
To set up mock numbers in Appwrite, you need to follow a few simple steps. | ||
|
||
## Step 1: Access the Appwrite console | ||
|
||
Log in to your Appwrite account and select the project you want to configure. Ensure phone authentication is enabled for your project. | ||
|
||
## Step 2: Configure mock numbers | ||
|
||
1. **Navigate to `Project > Auth > Security` :** Scroll to the **Mock phone numbers** section | ||
2. **Generate Mock Number**: Click the **generate number** button. This will generate a mock phone number and verification code that you can use to test user authentication. | ||
|
||
![Mock-numbers-Appwrite](/images/blog/mock-numbers-use-cases/1.png) | ||
|
||
You can regenerate the number and verification code by clicking the icon beside the input field or you can edit it directly. To generate another mock phone number and verification code, click the **Add number** button. | ||
|
||
3. **Save Changes**: Click the `Update` button to apply the mock number configurations. | ||
|
||
## Step 3: Implement mock numbers in your application | ||
|
||
Use Appwrite’s SDK to integrate phone sign-in and test the authentication flow with mock numbers. Let's walk through an example using the Appwrite JavaScript SDK. | ||
|
||
## Initialize Appwrite client and account | ||
|
||
First, you need to set up the Appwrite client and account objects: | ||
|
||
```jsx | ||
import { Client, Account } from 'appwrite' | ||
|
||
// Initialize Appwrite client | ||
const client = new Client() | ||
client.setEndpoint('https://cloud.appwrite.io/v1').setProject('your_project_id') | ||
|
||
// Initialize Account | ||
const account = new Account(client) | ||
|
||
``` | ||
|
||
In this code: | ||
|
||
- We import the necessary modules from the Appwrite SDK. | ||
- We create and configure a `Client` instance with the Appwrite endpoint and project ID. | ||
- We create an `Account` instance associated with the client. | ||
|
||
## Create a phone session using a mock number | ||
|
||
Next, create a function to handle phone sign-in with mock numbers: | ||
|
||
```jsx | ||
async function createPhoneSession(phone, secret) { | ||
try { | ||
// Create a phone token | ||
const token = await account.createPhoneToken('unique_id', phone.trim()) | ||
const userId = token.userId | ||
|
||
// Create a session using the provided secret | ||
const session = await account.createSession(userId, secret) | ||
console.log('Session created:', session) | ||
return session | ||
} catch (error) { | ||
console.error('Error creating phone session:', error) | ||
} | ||
} | ||
|
||
``` | ||
|
||
Here's what happens in this function: | ||
|
||
- The `createPhoneToken` method generates a phone token for the provided phone number. | ||
- We extract the `userId` from the token. | ||
- The `createSession` method creates a session using the `userId` and the provided secret (verification code). | ||
- If successful, the session details are logged; otherwise, the error is logged. | ||
|
||
## Example usage | ||
|
||
Finally, use the function to create a session with a mock number and verification code: | ||
|
||
```jsx | ||
const mockPhoneNumber = 'mock_phone_number'// Replace with your mock numberconst mockSecretCode = 'mock_verification_code'// Replace with your mock verification codecreatePhoneSession(mockPhoneNumber, mockSecretCode) | ||
|
||
``` | ||
|
||
In this example: | ||
|
||
- Replace `'mock_phone_number'` with your actual mock number. | ||
- Replace `'mock_verification_code'` with the verification code set for the mock number. | ||
|
||
## Step 4: Validate and test | ||
|
||
1. **Run tests**: Execute tests using the mock numbers to ensure that the phone sign-in flow behaves as expected. | ||
2. **Check results**: Verify that the session is created successfully and that all parts of the authentication flow are functioning correctly. | ||
|
||
# Best practices for using mock numbers | ||
|
||
## Consider security | ||
|
||
Use mock numbers only in development, testing, and demo environments. Avoid using them in production to maintain the integrity and security of your application’s authentication system. | ||
|
||
## Maintain consistency in test scenarios | ||
|
||
Ensure that mock numbers and verification codes are used consistently across different testing environments. This consistency helps achieve reliable and repeatable test results. | ||
|
||
## Document clearly | ||
|
||
Document the mock numbers and codes used in your testing processes. Include details about their purpose, the scenarios they are used for, and any specific configurations. | ||
|
||
## Separate environments | ||
|
||
Maintain a clear separation between mock setups and production environments. Use environment-specific configurations to avoid accidental use of mock numbers in live applications. | ||
|
||
## Recognize testing limitations | ||
|
||
Remember that mock numbers are useful for simulating the authentication flow but may not replicate all real-world conditions, such as network delays or SMS delivery issues. For comprehensive testing, real phone numbers and actual SMS delivery may still be necessary. | ||
|
||
## Clean up unused mock numbers | ||
|
||
Remove mock numbers that are not in use, or delete them once the tests are completed. This practice helps maintain a clean testing environment and prevents the accumulation of obsolete data. | ||
|
||
# Conclusion | ||
|
||
Mock numbers in Appwrite offer a practical solution for testing phone sign-in flows, facilitating development, QA testing, app reviews, and demonstrations. The feature will be available to Pro users in 1.6. | ||
|
||
By using mock numbers effectively and following best practices, you can streamline your testing processes and ensure a robust authentication experience for your users. | ||
|
||
Further reading and resources: | ||
|
||
- [Appwrite phone (SMS) auth docs](https://appwrite.io/docs/products/auth/phone-sms) | ||
- [Appwrite custom token docs](https://appwrite.io/docs/products/auth/custom-token) | ||
- [Our Discord community](https://appwrite.io/discord) |
80 changes: 80 additions & 0 deletions
80
src/routes/blog/post/open-source-contributors-16/+page.markdoc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
layout: post | ||
title: "Celebrating the open source contributors for Appwrite 1.6" | ||
description: With this release, we’d like to highlight and celebrate our open source contributors that made Appwrite what it is today. | ||
date: 2024-08-23 | ||
cover: /images/blog/contributors-16/cover.png | ||
timeToRead: 5 | ||
author: aditya-oberai | ||
category: open-source | ||
featured: false | ||
--- | ||
|
||
This week, we announced the brand new 1.6 version, which features major updates to the Functions ecosystem, including local development, an updated CLI, support for Go, and more. And, just like every major release before that, Appwrite 1.6 is a testament to the power of open-source collaboration. With over 40 developers contributing, we've been able to push for a faster, better, smoother product for everyone in the community. | ||
|
||
We're incredibly grateful for the dedication and hard work of our community. Every contribution, big or small, has made a significant impact. | ||
|
||
Therefore, we’d like to conclude Init by celebrating the people who made 1.6 possible — our open-source contributors. Thank you for helping us build a better Appwrite. | ||
|
||
# Thanks to all the contributors | ||
|
||
We appreciate the work of everyone involved, from coding and translations to documentation. We’d like to extend our deepest thanks to: | ||
|
||
- [@ItzNotABug](https://github.com/ItzNotABug) who: | ||
- added a theme on SPA Init in [#1190](https://github.com/appwrite/console/pull/1190) | ||
- fixed redirecting back to the dashboard during password recovery in [#1188](https://github.com/appwrite/console/pull/1188) | ||
- fixed PNPM commands in the Contributing guide in [#1256](https://github.com/appwrite/console/pull/1256) | ||
- removed unnecessary bullet point marker in [#1240](https://github.com/appwrite/console/pull/1240) | ||
- fixed the tooltip location in [#1275](https://github.com/appwrite/console/pull/1275) | ||
- fixed input label alignment in [#1234](https://github.com/appwrite/console/pull/1234) | ||
- fixed cancel icon shifting in [#1207](https://github.com/appwrite/console/pull/1207) | ||
- fixed failing `GitHub` install on preview instances in [#1282](https://github.com/appwrite/console/pull/1282) | ||
- removed unnecessary plus icon in [#1283](https://github.com/appwrite/console/pull/1283) | ||
- deleted expired tags per project in [#8239](https://github.com/appwrite/appwrite/pull/8239) | ||
- added tests to validate headers aren’t being overridden in [#8228](https://github.com/appwrite/appwrite/pull/8228) | ||
- added `default` to collection attributes in [#8271](https://github.com/appwrite/appwrite/pull/8271) | ||
- fixed document APIs that don't support redirects in [#8233](https://github.com/appwrite/appwrite/pull/8233) | ||
- fixed the domain check in [#8472](https://github.com/appwrite/appwrite/pull/8472) | ||
- updated Appwrite versions in [#884](https://github.com/appwrite/sdk-generator/pull/884) | ||
- [@blackviking27](https://github.com/blackviking27) who fixed the wizard footer overlapping with the language indicator in [#1152](https://github.com/appwrite/console/pull/1152) | ||
- [@iamAyushChamoli](https://github.com/iamAyushChamoli) who fixed syntax for Android in documentation in [#1238](https://github.com/appwrite/console/pull/1238) | ||
- [@Anush008](https://github.com/Anush008) who | ||
- added the sync-with-qdrant template for JavaScript in [#288](https://github.com/appwrite/templates/pull/288) | ||
- added the sync-with-qdrant template for TypeScript in [#290](https://github.com/appwrite/templates/pull/290) | ||
- added the sync-with-qdrant template for Bun in [#291](https://github.com/appwrite/templates/pull/291) | ||
- added the sync-with-qdrant template for Python in [#289](https://github.com/appwrite/templates/pull/289) | ||
- [@navjotNSK](https://github.com/navjotNSK) who added Hong Kong in translations by in [#8179](https://github.com/appwrite/appwrite/pull/8179) | ||
- [@2002Bishwajeet](https://github.com/2002Bishwajeet) who fixed setting the target field if the existing target document is false by in [#8236](https://github.com/appwrite/appwrite/pull/8236) | ||
- [@Achraf112Ben](https://github.com/Achraf112Ben) who added Darija (Moroccan Arabic) translation file in [#7501](https://github.com/appwrite/appwrite/pull/7501) | ||
- [@xuelink](https://github.com/xuelink) who removed unused import in templates in [#283](https://github.com/appwrite/templates/pull/283) | ||
- [@Snehasis4321](https://github.com/Snehasis4321) who fixed push notifications not working for node in [#282](https://github.com/appwrite/templates/pull/282) | ||
- [@kunalArya1](https://github.com/kunalArya1) who fixed variable names and logging in Web and React Native docs templates in [#890](https://github.com/appwrite/sdk-generator/pull/890) | ||
- [@MarkPerkins](https://github.com/MarkPerkins) who removed force unwrapping of incoming URL parameters in [#887](https://github.com/appwrite/sdk-generator/pull/887) | ||
- [@naman1608](https://github.com/naman1608) who improved inline docs for Android SDK templates in [#873](https://github.com/appwrite/sdk-generator/pull/873) | ||
- [@svenopdehipt](https://github.com/svenopdehipt) who updated the Flutter code to use `js_interop` in [#810](https://github.com/appwrite/sdk-generator/pull/810) | ||
- [@us3r001](https://github.com/us3r001) who fixed the `jsonSerialize` return type in PHP query template in [#869](https://github.com/appwrite/sdk-generator/pull/869) | ||
- [@Suven-p](https://github.com/Suven-p) who updated the Go client in [#647](https://github.com/appwrite/sdk-generator/pull/647) | ||
- [@Im-Madhur-Gupta](https://github.com/Im-Madhur-Gupta) who added inline doc comments to the Web SDK template in [#721](https://github.com/appwrite/sdk-generator/pull/721) | ||
- [@adarshjhaa100](https://github.com/adarshjhaa100) who created a hint to run Init and deploy commands in [#720](https://github.com/appwrite/sdk-generator/pull/720) | ||
- [@zlmr](https://github.com/zlmr) who: | ||
- fixed closing Android realtime socket properly on unsubscribe in [#814](https://github.com/appwrite/sdk-generator/pull/814) | ||
- fixed Apple realtime socket cleanup in [#815](https://github.com/appwrite/sdk-generator/pull/815) | ||
- [@StarZeus](https://github.com/StarZeus) who helped fix an Appwrite CLI login issue regarding the setting of cookies in [#802](https://github.com/appwrite/sdk-generator/pull/802) | ||
- [@theemaster](https://github.com/theemaster) who updated .NET SDK to allow null value in user model in [#800](https://github.com/appwrite/sdk-generator/pull/800) | ||
- [@KillTrot](https://github.com/KillTrot) who changed `GetValues` to `TryGetValues` when parsing Content-Type header in the .NET SDK in [#806](https://github.com/appwrite/sdk-generator/pull/806) | ||
- [@svenopdehipt](https://github.com/svenopdehipt) who added support for vision OS and fixed warnings & errors in [#777](https://github.com/appwrite/sdk-generator/pull/777) | ||
|
||
# How you can contribute | ||
|
||
Open source is at the core of Appwrite. We believe in building in the open, sharing our code, and welcoming contributions from the community. Many of our engineers came from the open-source community at Appwrite and stayed for the long run. | ||
|
||
If you would like to play a more substantial role in the development of Appwrite, here are some ways you can make a difference: | ||
|
||
- Share your suggestions in the [issues](https://github.com/appwrite/appwrite/issues) listed on our GitHub repo. | ||
- Make bug fixes and feature contributions by creating [pull requests](https://github.com/appwrite/appwrite/pulls). | ||
- Raise feedback and new ideas about Appwrite in our [GitHub Discussions](https://github.com/appwrite/appwrite/discussions). | ||
- Participate with other Appwrite developers in our [Discord community](https://appwrite.io/discord). | ||
- Share your Appwrite project with our community on the [Built With Appwrite](https://builtwith.appwrite.io/) platform. | ||
- Add any Appwrite-related educational content on our [awesome-appwrite](https://github.com/appwrite/awesome-appwrite) repo. | ||
|
||
Together, let’s continue to build Appwrite through the power of open-source, and help every developer build like a team of hundreds. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
layout: changelog | ||
title: Introducing mock numbers and session alerts in Auth | ||
date: 2024-08-23 | ||
cover: /images/changelog/2024-08-23.png | ||
--- | ||
|
||
We’ve listened to your feedback and are introducing two new features designed to simplify phone authentication testing and bolster account security. | ||
|
||
Mock numbers allow you to set up a list of phone numbers with a predefined, static verification code, which is perfect for app reviews and testing. Session alerts will help your users maintain their account security. | ||
|
||
{% arrow_link href="/blog/post/announcing-mock-numbers-session-alerts" %} | ||
Read the announcement to learn more | ||
{% /arrow_link %} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.