@@ -178,17 +178,20 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
178178 * @param authSession the auth session received from the server as part of the public key challenge request.
179179 * @param authResponse the [PublicKeyCredentials] authentication response
180180 * @param realm the connection to use. If excluded, the application will use the default connection configured in the tenant
181+ * @param organization id of the organization to be associated with the user while signing in
181182 * @return a request to configure and start that will yield [Credentials]
182183 */
183184 public fun signinWithPasskey (
184185 authSession : String ,
185186 authResponse : PublicKeyCredentials ,
186- realm : String? = null
187+ realm : String? = null,
188+ organization : String? = null,
187189 ): AuthenticationRequest {
188190 val params = ParameterBuilder .newBuilder().apply {
189191 setGrantType(ParameterBuilder .GRANT_TYPE_PASSKEY )
190192 set(AUTH_SESSION_KEY , authSession)
191193 realm?.let { setRealm(it) }
194+ organization?.let { set(ORGANIZATION_KEY ,organization) }
192195 }.asDictionary()
193196
194197 return loginWithToken(params)
@@ -257,11 +260,13 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
257260 *
258261 * @param userData user information of the client
259262 * @param realm the connection to use. If excluded, the application will use the default connection configured in the tenant
263+ * @param organization id of the organization to be associated with the user while signing up
260264 * @return a request to configure and start that will yield [PasskeyRegistrationChallenge]
261265 */
262266 public fun signupWithPasskey (
263267 userData : UserData ,
264- realm : String? = null
268+ realm : String? = null,
269+ organization : String? = null
265270 ): Request <PasskeyRegistrationChallenge , AuthenticationException > {
266271 val user = gson.toJsonTree(userData)
267272 val url = auth0.getDomainUrl().toHttpUrl().newBuilder()
@@ -272,6 +277,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
272277 val params = ParameterBuilder .newBuilder().apply {
273278 setClientId(clientId)
274279 realm?.let { setRealm(it) }
280+ organization?.let { set(ORGANIZATION_KEY , it) }
275281 }.asDictionary()
276282
277283 val passkeyRegistrationChallengeAdapter: JsonAdapter <PasskeyRegistrationChallenge > =
@@ -304,7 +310,8 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
304310 * @return a request to configure and start that will yield [PasskeyChallenge]
305311 */
306312 public fun passkeyChallenge (
307- realm : String? = null
313+ realm : String? = null,
314+ organization : String? = null
308315 ): Request <PasskeyChallenge , AuthenticationException > {
309316 val url = auth0.getDomainUrl().toHttpUrl().newBuilder()
310317 .addPathSegment(PASSKEY_PATH )
@@ -314,6 +321,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
314321 val parameters = ParameterBuilder .newBuilder().apply {
315322 setClientId(clientId)
316323 realm?.let { setRealm(it) }
324+ organization?.let { set(ORGANIZATION_KEY , organization) }
317325 }.asDictionary()
318326
319327 val passkeyChallengeAdapter: JsonAdapter <PasskeyChallenge > = GsonAdapter (
@@ -1054,7 +1062,7 @@ public class AuthenticationAPIClient @VisibleForTesting(otherwise = VisibleForTe
10541062 private const val RECOVERY_CODE_KEY = " recovery_code"
10551063 private const val SUBJECT_TOKEN_KEY = " subject_token"
10561064 private const val SUBJECT_TOKEN_TYPE_KEY = " subject_token_type"
1057- private const val REQUESTED_TOKEN_TYPE_KEY = " requested_token_type "
1065+ private const val ORGANIZATION_KEY = " organization "
10581066 private const val USER_METADATA_KEY = " user_metadata"
10591067 private const val AUTH_SESSION_KEY = " auth_session"
10601068 private const val AUTH_RESPONSE_KEY = " authn_response"
0 commit comments