# RemoteAuthRequestHandler

# RemoteAuthRequestHandler

Artifact:[androidx.wear:wear-phone-interactions](https://developer.android.com/jetpack/androidx/releases/wear)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/phone/interactions/authentication/RemoteAuthService.kt+class:androidx.wear.phone.interactions.authentication.RemoteAuthRequestHandler)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/phone/interactions/authentication/RemoteAuthRequestHandler "View this page in Java")

<br />

```
interface RemoteAuthRequestHandler
```

<br />

*** ** * ** ***

Interface for specifying how the service handles the remote auth requests.

## Summary

|                                ### Public functions                                 |
|-------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [isAuthSupported](https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/RemoteAuthRequestHandler#isAuthSupported())`()` Whether the auth service is enabled, return false would give an early out by sending the 3p app a response with error code of ERROR_UNSUPPORTED                                                                                                                                                                                                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)       | [sendAuthRequest](https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/RemoteAuthRequestHandler#sendAuthRequest(androidx.wear.phone.interactions.authentication.OAuthRequest,kotlin.Pair))`(` ` request: `[OAuthRequest](https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest)`,` ` packageNameAndRequestId: `[Pair](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`, `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`>` `)` Handle the auth request by sending it to the phone. |

## Public functions

### isAuthSupported

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)  

```
fun isAuthSupported(): Boolean
```

Whether the auth service is enabled, return false would give an early out by sending the 3p app a response with error code of ERROR_UNSUPPORTED  

### sendAuthRequest

Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)  

```
fun sendAuthRequest(
    request: OAuthRequest,
    packageNameAndRequestId: Pair<String, Int>
): Unit
```

Handle the auth request by sending it to the phone. Typically, if the paired phone is not connected, send a response with error code of[RemoteAuthClient.ERROR_PHONE_UNAVAILABLE](https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/RemoteAuthClient#ERROR_PHONE_UNAVAILABLE()); otherwise listening for the response from the phone and send it back to the 3p app.

[RemoteAuthService.sendResponseToCallback](https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/RemoteAuthService#sendResponseToCallback(androidx.wear.phone.interactions.authentication.OAuthResponse,kotlin.Pair))is provided for sending response back to the callback provided by the 3p app.