Package com.smartcar.sdk
Class AuthClient
- java.lang.Object
-
- com.smartcar.sdk.AuthClient
-
public class AuthClient extends java.lang.Object
Smartcar OAuth 2.0 Authentication Client
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AuthClient.AuthUrlBuilder
A builder for creating Authorization URLs.static class
AuthClient.Builder
Builds a new AuthClient.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthClient.AuthUrlBuilder
authUrlBuilder(java.lang.String[] scope)
Creates an AuthUrlBuilderAuth
exchangeCode(java.lang.String code)
Exchanges an authorization code for an access token.Auth
exchangeCode(java.lang.String code, SmartcarAuthOptions options)
Exchanges an authorization code for an access token.Auth
exchangeRefreshToken(java.lang.String refreshToken)
Exchanges a refresh token for a new access token.Auth
exchangeRefreshToken(java.lang.String refreshToken, SmartcarAuthOptions options)
Exchanges a refresh token for a new access token.java.lang.String
getClientId()
java.lang.String
getClientSecret()
java.lang.String
getRedirectUri()
-
-
-
Method Detail
-
authUrlBuilder
public AuthClient.AuthUrlBuilder authUrlBuilder(java.lang.String[] scope)
Creates an AuthUrlBuilder- Parameters:
scope
- the permission scope(s) requested- Returns:
- returns an instance of AuthUrlBuilder
-
exchangeCode
public Auth exchangeCode(java.lang.String code) throws SmartcarException
Exchanges an authorization code for an access token.- Parameters:
code
- the authorization code- Returns:
- the requested access token
- Throws:
SmartcarException
- when the request is unsuccessful
-
exchangeCode
public Auth exchangeCode(java.lang.String code, SmartcarAuthOptions options) throws SmartcarException
Exchanges an authorization code for an access token.- Parameters:
code
- the authorization codeoptions
- the SmartcarAuthOptions- Returns:
- the requested access token
- Throws:
SmartcarException
- when the request is unsuccessful
-
exchangeRefreshToken
public Auth exchangeRefreshToken(java.lang.String refreshToken) throws SmartcarException
Exchanges a refresh token for a new access token.- Parameters:
refreshToken
- the refresh token- Returns:
- the requested access token
- Throws:
SmartcarException
- when the request is unsuccessful
-
exchangeRefreshToken
public Auth exchangeRefreshToken(java.lang.String refreshToken, SmartcarAuthOptions options) throws SmartcarException
Exchanges a refresh token for a new access token.- Parameters:
refreshToken
- the refresh tokenoptions
- the SmartcarAuthOptions- Returns:
- the requested access token
- Throws:
SmartcarException
- when the request is unsuccessful
-
getClientId
public java.lang.String getClientId()
-
getClientSecret
public java.lang.String getClientSecret()
-
getRedirectUri
public java.lang.String getRedirectUri()
-
-