Repository navigation
feat: SDK update for version 28.0.0 #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
199024c
9fe9907
c5a3ef8
97c9461
236e085
c52edb8
ea9b64a
4bde5bc
f19e2fa
a438838
ddfdab5
8dd3940
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||
| ```java | ||||||
| import android.util.Log; | ||||||
|
|
||||||
| import io.appwrite.Client; | ||||||
| import io.appwrite.coroutines.CoroutineCallback; | ||||||
| import io.appwrite.services.Account; | ||||||
| import io.appwrite.enums.IdTokenProvider; | ||||||
|
|
||||||
| Client client = new Client(context) | ||||||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||||||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||||||
|
|
||||||
| Account account = new Account(client); | ||||||
|
|
||||||
| account.createIdTokenSession( | ||||||
| IdTokenProvider.APPLE, // provider | ||||||
| "<ID_TOKEN>", // idToken | ||||||
| "<NONCE>", // nonce (optional) | ||||||
| "<ACCESS_TOKEN>", // accessToken (optional) | ||||||
| 0, // accessTokenExpiry (optional) | ||||||
| "<NAME>", // name (optional) | ||||||
| new CoroutineCallback<>((result, error) -> { | ||||||
| if (error != null) { | ||||||
| error.printStackTrace(); | ||||||
| return; | ||||||
| } | ||||||
|
|
||||||
| Log.d("Appwrite", result.toString()); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
How this was verified: The method accepts an access token to store on the session, and
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: docs/examples/java/account/create-id-token-session.md
Line: 28
Comment:
**Session credentials logged** If a developer supplies the access token shown in this example, logging the full returned `Session` can write that credential to Android logs. Log a non-sensitive field such as the session ID instead.
**How this was verified:** The method accepts an access token to store on the session, and `Session.toString()` includes its `providerAccessToken` field before this example passes it to `Log.d`.
```suggestion
Log.d("Appwrite", result.getId());
```
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly. |
||||||
| }) | ||||||
| ); | ||||||
|
|
||||||
| ``` | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ```java | ||
| import android.util.Log; | ||
|
|
||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.Account; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| Account account = new Account(client); | ||
|
|
||
| account.createRecoveryOTP( | ||
| "email@example.com", // email | ||
| false, // phrase (optional) | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| ```java | ||
| import android.util.Log; | ||
|
|
||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.Account; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| Account account = new Account(client); | ||
|
|
||
| account.updateEmailVerificationOTP( | ||
| "<USER_ID>", // userId | ||
| "<SECRET>", // secret | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| ```java | ||
| import android.util.Log; | ||
|
|
||
| import io.appwrite.Client; | ||
| import io.appwrite.coroutines.CoroutineCallback; | ||
| import io.appwrite.services.Account; | ||
|
|
||
| Client client = new Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>"); // Your project ID | ||
|
|
||
| Account account = new Account(client); | ||
|
|
||
| account.updateRecoveryOTP( | ||
| "<USER_ID>", // userId | ||
| "<SECRET>", // secret | ||
| "password", // password | ||
| new CoroutineCallback<>((result, error) -> { | ||
| if (error != null) { | ||
| error.printStackTrace(); | ||
| return; | ||
| } | ||
|
|
||
| Log.d("Appwrite", result.toString()); | ||
| }) | ||
| ); | ||
|
|
||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| ```kotlin | ||
| import io.appwrite.Client | ||
| import io.appwrite.coroutines.CoroutineCallback | ||
| import io.appwrite.services.Account | ||
| import io.appwrite.enums.IdTokenProvider | ||
|
|
||
| val client = Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>") // Your project ID | ||
|
|
||
| val account = Account(client) | ||
|
|
||
| val result = account.createIdTokenSession( | ||
| provider = IdTokenProvider.APPLE, | ||
| idToken = "<ID_TOKEN>", | ||
| nonce = "<NONCE>", // (optional) | ||
| accessToken = "<ACCESS_TOKEN>", // (optional) | ||
| accessTokenExpiry = 0, // (optional) | ||
| name = "<NAME>", // (optional) | ||
| ) | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ```kotlin | ||
| import io.appwrite.Client | ||
| import io.appwrite.coroutines.CoroutineCallback | ||
| import io.appwrite.services.Account | ||
|
|
||
| val client = Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>") // Your project ID | ||
|
|
||
| val account = Account(client) | ||
|
|
||
| val result = account.createRecoveryOTP( | ||
| email = "email@example.com", | ||
| phrase = false, // (optional) | ||
| ) | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| ```kotlin | ||
| import io.appwrite.Client | ||
| import io.appwrite.coroutines.CoroutineCallback | ||
| import io.appwrite.services.Account | ||
|
|
||
| val client = Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>") // Your project ID | ||
|
|
||
| val account = Account(client) | ||
|
|
||
| val result = account.updateEmailVerificationOTP( | ||
| userId = "<USER_ID>", | ||
| secret = "<SECRET>", | ||
| ) | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ```kotlin | ||
| import io.appwrite.Client | ||
| import io.appwrite.coroutines.CoroutineCallback | ||
| import io.appwrite.services.Account | ||
|
|
||
| val client = Client(context) | ||
| .setEndpoint("https://<REGION>.cloud.appwrite.io/v1") // Your API Endpoint | ||
| .setProject("<YOUR_PROJECT_ID>") // Your project ID | ||
|
|
||
| val account = Account(client) | ||
|
|
||
| val result = account.updateRecoveryOTP( | ||
| userId = "<USER_ID>", | ||
| secret = "<SECRET>", | ||
| password = "password", | ||
| ) | ||
| ``` |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package io.appwrite.enums | ||
|
|
||
| import com.google.gson.annotations.SerializedName | ||
|
|
||
| enum class IdTokenProvider(val value: String) { | ||
| @SerializedName("apple") | ||
| APPLE("apple"), | ||
| @SerializedName("google") | ||
| GOOGLE("google"); | ||
|
|
||
| override fun toString() = value | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0foraccessTokenExpiry, but the method expects a boxedLong, so the sample does not compile. Changing it to0Lalone would make the example’s access token immediately expired; the Kotlin sample also supplies zero seconds. Omit the optional expiry or use the provider-reported lifetime.Prompt To Fix With AI