Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v1
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
- name: Prepare environment
env:
Expand Down
12 changes: 9 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# Change Log

## 24.1.0

* Added: Added `setCookie()` method to `Client` for forwarding incoming `Cookie` headers in server-side runtimes
* Added: Added `Fusionauth`, `Keycloak`, and `Kick` OAuth providers to `OAuthProvider` enum
* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.4`

## 24.0.0

* Breaking: Added `unsubscribe()`, `update()`, and `close()` for Realtime subscription lifecycle.
* Added: Added `userPhone` to the `Membership` model.
* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.2`.
* Breaking: Added `unsubscribe()`, `update()`, and `close()` to Realtime subscriptions
* Added: Added `userPhone` field to `Membership` model
* Updated: Updated `X-Appwrite-Response-Format` header to `1.9.2`

## 23.1.0

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![Maven Central](https://img.shields.io/maven-central/v/io.appwrite/sdk-for-android.svg?color=green&style=flat-square)
![License](https://img.shields.io/github/license/appwrite/sdk-for-android.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.2-blue.svg?style=flat-square)
![Version](https://img.shields.io/badge/api%20version-1.9.4-blue.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/com/appwrite/sdk-generator?style=flat-square)](https://travis-ci.com/appwrite/sdk-generator)
[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee&label=twitter&style=flat-square)](https://twitter.com/appwrite)
[![Discord](https://img.shields.io/discord/564160730845151244?label=discord&style=flat-square)](https://appwrite.io/discord)
Expand Down Expand Up @@ -38,7 +38,7 @@ repositories {
Next, add the dependency to your project's `build.gradle(.kts)` file:

```groovy
implementation("io.appwrite:sdk-for-android:24.0.0")
implementation("io.appwrite:sdk-for-android:24.1.0")
```

### Maven
Expand All @@ -49,7 +49,7 @@ Add this to your project's `pom.xml` file:
<dependency>
<groupId>io.appwrite</groupId>
<artifactId>sdk-for-android</artifactId>
<version>24.0.0</version>
<version>24.1.0</version>
</dependency>
</dependencies>
```
Expand Down
19 changes: 17 additions & 2 deletions library/src/main/java/io/appwrite/Client.kt
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class Client @JvmOverloads constructor(
"x-sdk-name" to "Android",
"x-sdk-platform" to "client",
"x-sdk-language" to "android",
"x-sdk-version" to "24.0.0",
"x-appwrite-response-format" to "1.9.2"
"x-sdk-version" to "24.1.0",
"x-appwrite-response-format" to "1.9.4"
)
config = mutableMapOf()

Expand Down Expand Up @@ -168,6 +168,21 @@ class Client @JvmOverloads constructor(
return this
}

/**
* Set Cookie
*
* The user cookie to authenticate with. Used by SDKs that forward an incoming Cookie header in server-side runtimes.
*
* @param {string} cookie
*
* @return this
*/
fun setCookie(value: String): Client {
config["cookie"] = value
addHeader("cookie", value)
return this
}
Comment on lines +180 to +184

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 setCookie may conflict with the existing cookie jar

The Client is already configured with a ListenableCookieJar (CookiePolicy.ACCEPT_ALL) backed by SharedPreferencesCookieStore. When OkHttp's BridgeInterceptor executes, it adds cookies from the jar to the outgoing Cookie header. Injecting a second raw "cookie" header via addHeader may result in duplicate or merged Cookie headers whose precedence depends on OkHttp internals, potentially overwriting persisted session cookies or confusing the server.

The KDoc states this method is "Used by SDKs that forward an incoming Cookie header in server-side runtimes", but the Android SDK is a client-side SDK that already manages cookies automatically. Callers on Android who invoke this method expecting server-forwarding behaviour may instead see unexpected cookie collisions with the shared-preferences store.


/**
* Set ImpersonateUserId
*
Expand Down
6 changes: 6 additions & 0 deletions library/src/main/java/io/appwrite/enums/OAuthProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,18 @@ enum class OAuthProvider(val value: String) {
FACEBOOK("facebook"),
@SerializedName("figma")
FIGMA("figma"),
@SerializedName("fusionauth")
FUSIONAUTH("fusionauth"),
@SerializedName("github")
GITHUB("github"),
@SerializedName("gitlab")
GITLAB("gitlab"),
@SerializedName("google")
GOOGLE("google"),
@SerializedName("keycloak")
KEYCLOAK("keycloak"),
@SerializedName("kick")
KICK("kick"),
@SerializedName("linkedin")
LINKEDIN("linkedin"),
@SerializedName("microsoft")
Expand Down
4 changes: 2 additions & 2 deletions library/src/main/java/io/appwrite/services/Account.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@ class Account(client: Client) : Service(client) {
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
*
*
* @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
* @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
* @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
Expand Down Expand Up @@ -1924,7 +1924,7 @@ class Account(client: Client) : Service(client) {
*
* A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
*
* @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, github, gitlab, google, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
* @param provider OAuth2 Provider. Currently, supported providers are: amazon, apple, auth0, authentik, autodesk, bitbucket, bitly, box, dailymotion, discord, disqus, dropbox, etsy, facebook, figma, fusionauth, github, gitlab, google, keycloak, kick, linkedin, microsoft, notion, oidc, okta, paypal, paypalSandbox, podio, salesforce, slack, spotify, stripe, tradeshift, tradeshiftBox, twitch, wordpress, x, yahoo, yammer, yandex, zoho, zoom.
* @param success URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param failure URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project's platform list are allowed. This requirement helps to prevent an [open redirect](https://cheatsheetseries.owasp.org/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.html) attack against your project API.
* @param scopes A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes. Maximum of 100 scopes are allowed, each 4096 characters long.
Expand Down
Loading