# OAuthRequest

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/OAuthRequest.kt+class:androidx.wear.phone.interactions.authentication.OAuthRequest) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear#1.0.0)

*** ** * ** ***


```
class OAuthRequest
```

<br />

*** ** * ** ***

The OAuth request to be sent to the server to start the OAuth 2 authentication flow.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest.Builder` Builder for constructing new instance of OAuth request. |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest#WEAR_REDIRECT_URL_PREFIX()` The default google-specific custom URL to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest#WEAR_REDIRECT_URL_PREFIX_CN()` The default google-specific custom URL in China to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest#packageName()` The package name of the app sending the auth request. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest#redirectUrl()` The redirect url the companion app is registered to. |
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/kotlin/androidx/wear/phone/interactions/authentication/OAuthRequest#requestUrl()` The Url of the auth request. |

## Constants

### WEAR_REDIRECT_URL_PREFIX

```
const val WEAR_REDIRECT_URL_PREFIX: String
```

The default google-specific custom URL to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device.

### WEAR_REDIRECT_URL_PREFIX_CN

```
const val WEAR_REDIRECT_URL_PREFIX_CN: String
```

The default google-specific custom URL in China to route the response from the auth server back to the 1P companion app, which then forwards it to the 3P app that made the request on the wear device.

## Public properties

### packageName

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

```
val packageName: String
```

The package name of the app sending the auth request.

### redirectUrl

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

```
val redirectUrl: String
```

The redirect url the companion app is registered to. If it doesn't exist, an empty string will be returned.

### requestUrl

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

```
val requestUrl: Uri
```

The Url of the auth request.

The request is expected to create a URL with the following format:

```kotlin
    https://authorization-server.com/auth?client_id=XXXXX
    &redirect_uri=https://wear.googleapis.com/3p_auth/mypackagename
    &response_type=code
    &code_challenge=XXXXX...XXX
    &code_challenge_method=S256
```