Tizen Native API  8.0

The OAuth 2.0 APIs provide easy way to gain access token between server and client.

Required Header

#include <oauth2.h>

Overview

The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/oauth2

It is recommended to design feature related codes in your application for reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature List.

Tizen OAuth 2.0 Authorization Framework. Refer to rfc6749 about OAuth 2.0. Also service provider document needs to be referred for using end points and additional parameters.

Functions

OAUTH2_API int oauth2_error_get_code (oauth2_error_h handle, int *server_error_code, int *platform_error_code)
 Gets error code.
OAUTH2_API int oauth2_error_get_description (oauth2_error_h handle, char **description)
 Gets error description.
OAUTH2_API int oauth2_error_get_uri (oauth2_error_h handle, char **uri)
 Gets error uri.
OAUTH2_API int oauth2_error_get_custom_data (oauth2_error_h handle, const char *custom_key, char **custom_value)
 Gets the custom data.
OAUTH2_API int oauth2_manager_create (oauth2_manager_h *handle)
 Creates oauth2_manager_h handle.
OAUTH2_API int oauth2_manager_destroy (oauth2_manager_h handle)
 Destroys oauth2_manager_h handle.
OAUTH2_API int oauth2_manager_request_token (oauth2_manager_h handle, oauth2_request_h request, oauth2_token_cb callback, void *user_data)
 Request OAuth 2.0 access token.
OAUTH2_API int oauth2_manager_request_authorization_grant (oauth2_manager_h handle, oauth2_request_h request, oauth2_auth_grant_cb callback, void *user_data)
 Request authorization grant.
OAUTH2_API int oauth2_manager_request_access_token (oauth2_manager_h handle, oauth2_request_h request, oauth2_access_token_cb callback, void *user_data)
 Requests an access token.
OAUTH2_API int oauth2_manager_refresh_access_token (oauth2_manager_h handle, oauth2_request_h request, oauth2_refresh_token_cb callback, void *user_data)
 Requests a refresh token.
OAUTH2_API bool oauth2_manager_is_request_in_progress (oauth2_manager_h handle)
 Returns whether oauth2_manager related request is pending.
OAUTH2_API int oauth2_manager_clear_cookies (oauth2_manager_h handle)
 Clears the cookies.
OAUTH2_API int oauth2_manager_clear_cache (oauth2_manager_h handle)
 Clears the cache.
OAUTH2_API int oauth2_request_create (oauth2_request_h *handle)
 Creates oauth2_request_h handle.
OAUTH2_API int oauth2_request_destroy (oauth2_request_h handle)
 Destroys oauth2_request_h handle.
OAUTH2_API int oauth2_request_set_auth_end_point_url (oauth2_request_h handle, const char *url)
 Sets authorization end point URL.
OAUTH2_API int oauth2_request_set_token_end_point_url (oauth2_request_h handle, const char *url)
 Sets access token end point URL.
OAUTH2_API int oauth2_request_set_redirection_url (oauth2_request_h handle, const char *url)
 Sets redirection URL.
OAUTH2_API int oauth2_request_set_refresh_token_url (oauth2_request_h handle, const char *url)
 Sets refresh token end point URL.
OAUTH2_API int oauth2_request_set_refresh_token (oauth2_request_h handle, char *refresh_token)
 Sets refresh token. Used mostly while using oauth2_manager_refresh_access_token().
OAUTH2_API int oauth2_request_set_response_type (oauth2_request_h handle, oauth2_response_type_e response_type)
 Sets response type.
OAUTH2_API int oauth2_request_set_client_id (oauth2_request_h handle, const char *client_id)
 Sets client id.
OAUTH2_API int oauth2_request_set_client_secret (oauth2_request_h handle, const char *client_secret)
 Sets client secret.
OAUTH2_API int oauth2_request_set_client_authentication_type (oauth2_request_h handle, oauth2_client_authentication_type_e client_auth_type)
 Sets client authentication type. Default is OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC.
OAUTH2_API int oauth2_request_set_scope (oauth2_request_h handle, const char *scope)
 Sets scope.
OAUTH2_API int oauth2_request_set_state (oauth2_request_h handle, const char *state)
 Sets state.
OAUTH2_API int oauth2_request_set_grant_type (oauth2_request_h handle, oauth2_grant_type_e grant_type)
 Sets grant type.
OAUTH2_API int oauth2_request_set_authorization_code (oauth2_request_h handle, const char *code)
 Sets authorization code.
OAUTH2_API int oauth2_request_set_user_name (oauth2_request_h handle, const char *user_name)
 Sets user name.
OAUTH2_API int oauth2_request_set_password (oauth2_request_h handle, const char *password)
 Sets password.
OAUTH2_API int oauth2_request_add_custom_data (oauth2_request_h handle, const char *key, const char *value)
 Adds custom key-value pair to the request.
OAUTH2_API int oauth2_request_get_auth_end_point_url (oauth2_request_h handle, char **url)
 Gets authorization end point URL.
OAUTH2_API int oauth2_request_get_token_end_point_url (oauth2_request_h handle, char **url)
 Gets access token end point URL.
OAUTH2_API int oauth2_request_get_redirection_url (oauth2_request_h handle, char **url)
 Gets redirection URL.
OAUTH2_API int oauth2_request_get_refresh_token_url (oauth2_request_h handle, char **url)
 Gets refresh token end point URL.
OAUTH2_API int oauth2_request_get_refresh_token (oauth2_request_h handle, char **refresh_token)
 Gets refresh token.
OAUTH2_API int oauth2_request_get_response_type (oauth2_request_h handle, oauth2_response_type_e *response_type)
 Gets response type.
OAUTH2_API int oauth2_request_get_client_id (oauth2_request_h handle, char **client_id)
 Gets client id.
OAUTH2_API int oauth2_request_get_client_secret (oauth2_request_h handle, char **client_secret)
 Gets client secret.
OAUTH2_API int oauth2_request_get_scope (oauth2_request_h handle, char **scope)
 Gets scope.
OAUTH2_API int oauth2_request_get_state (oauth2_request_h handle, char **state)
 Gets state.
OAUTH2_API int oauth2_request_get_grant_type (oauth2_request_h handle, oauth2_grant_type_e *grant_type)
 Gets grant type.
OAUTH2_API int oauth2_request_get_authorization_code (oauth2_request_h handle, char **code)
 Gets authorization code.
OAUTH2_API int oauth2_request_get_user_name (oauth2_request_h handle, char **user_name)
 Gets user name.
OAUTH2_API int oauth2_request_get_password (oauth2_request_h handle, char **password)
 Gets password.
OAUTH2_API int oauth2_request_get_custom_data (oauth2_request_h handle, const char *custom_key, char **custom_value)
 Gets the custom value.
OAUTH2_API int oauth2_response_destroy (oauth2_response_h handle)
 Destroys the received handle.
OAUTH2_API int oauth2_response_get_authorization_code (oauth2_response_h handle, char **code)
 Gets the authorization code.
OAUTH2_API int oauth2_response_get_state (oauth2_response_h handle, char **state)
 Gets state.
OAUTH2_API int oauth2_response_get_access_token (oauth2_response_h handle, char **access_token)
 Gets access token.
OAUTH2_API int oauth2_response_get_token_type (oauth2_response_h handle, char **token_type)
 Gets token type.
OAUTH2_API int oauth2_response_get_expires_in (oauth2_response_h handle, long long *expires_in)
 Gets expiry time.
OAUTH2_API int oauth2_response_get_refresh_token (oauth2_response_h handle, char **refresh_token)
 Gets refresh token.
OAUTH2_API int oauth2_response_get_scope (oauth2_response_h handle, char **scope)
 Gets scope.
OAUTH2_API int oauth2_response_get_error (oauth2_response_h handle, oauth2_error_h *error)
 Gets error.
OAUTH2_API int oauth2_response_get_custom_data (oauth2_response_h handle, const char *custom_key, char **custom_value)
 Gets the custom data.

Typedefs

typedef struct oauth2_error_s * oauth2_error_h
 The structure type for OAuth 2.0 Error handle.
typedef struct oauth2_manager_s * oauth2_manager_h
 The structure type for OAuth 2.0 Manager handle.
typedef void(* oauth2_token_cb )(oauth2_response_h response, void *user_data)
 Called when the oauth2_manager_request_token() response comes.
typedef void(* oauth2_auth_grant_cb )(oauth2_response_h response, void *user_data)
 Called when oauth2_manager_request_authorization_grant() response comes.
typedef void(* oauth2_access_token_cb )(oauth2_response_h response, void *user_data)
 Called when oauth2_manager_request_access_token() response comes.
typedef void(* oauth2_refresh_token_cb )(oauth2_response_h response, void *user_data)
 Called when oauth2_manager_refresh_access_token() response comes.
typedef struct oauth2_request_s * oauth2_request_h
 The structure type for OAuth 2.0 Request handle.
typedef struct oauth2_response_s * oauth2_response_h
 The structure type for OAuth 2.0 Response handle.

Typedef Documentation

typedef void(* oauth2_access_token_cb)(oauth2_response_h response, void *user_data)

Called when oauth2_manager_request_access_token() response comes.

Since :
2.4
Parameters:
[in]responseThe response. The response must be released using oauth2_response_destroy().
[in]user_dataThe user data passed from the callback function.
Precondition:
oauth2_manager_request_access_token() must be called to get this callback invoked.
See also:
oauth2_manager_request_access_token()
typedef void(* oauth2_auth_grant_cb)(oauth2_response_h response, void *user_data)

Called when oauth2_manager_request_authorization_grant() response comes.

Since :
2.4
Parameters:
[in]responseThe response. The response must be released using oauth2_response_destroy().
[in]user_dataThe user data passed from the callback function.
Precondition:
oauth2_manager_request_authorization_grant() must be called to get this callback invoked.
See also:
oauth2_manager_request_authorization_grant()
typedef struct oauth2_error_s* oauth2_error_h

The structure type for OAuth 2.0 Error handle.

Since :
2.4
typedef struct oauth2_manager_s* oauth2_manager_h

The structure type for OAuth 2.0 Manager handle.

Since :
2.4
typedef void(* oauth2_refresh_token_cb)(oauth2_response_h response, void *user_data)

Called when oauth2_manager_refresh_access_token() response comes.

Since :
2.4
Parameters:
[in]responseThe response. The response must be released using oauth2_response_destroy().
[in]user_dataThe user data passed from the callback function.
Precondition:
oauth2_manager_refresh_access_token() must be called to get this callback invoked.
See also:
oauth2_manager_refresh_access_token().
typedef struct oauth2_request_s* oauth2_request_h

The structure type for OAuth 2.0 Request handle.

Since :
2.4
typedef struct oauth2_response_s* oauth2_response_h

The structure type for OAuth 2.0 Response handle.

Since :
2.4
typedef void(* oauth2_token_cb)(oauth2_response_h response, void *user_data)

Called when the oauth2_manager_request_token() response comes.

Since :
2.4
Remarks:
The response must be released using oauth2_response_destroy().
Parameters:
[in]responseThe response
[in]user_dataThe user data passed from the callback function
Precondition:
oauth2_manager_request_token() must be called to get this callback invoked.
See also:
oauth2_manager_request_token()

Enumeration Type Documentation

Enumerations for Client authentication scheme, used to sign client id and client secret accordingly.

Since :
2.4
Remarks:
Facebook and Google does not support HTTP Basic Authentication, instead they require client credentials to be sent via request body. Default is OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC (rfc2617::section-2)
See also:
oauth2_request_set_client_authentication_type()
Enumerator:
OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC 

HTTP Basic Authentication for client authentication.

OAUTH2_CLIENT_AUTHENTICATION_TYPE_DIGEST 

HTTP Digest Authentication for client authentication.

OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY 

Client credentials are sent via request body

Enumerations of error codes for oauth2 APIs.

Since :
2.4
Enumerator:
OAUTH2_ERROR_NONE 

Successful

OAUTH2_ERROR_OUT_OF_MEMORY 

Out of memory

OAUTH2_ERROR_INVALID_PARAMETER 

Invalid parameter

OAUTH2_ERROR_ALREADY_IN_PROGRESS 

Operation already in progress

OAUTH2_ERROR_NOT_SUPPORTED 

Operation not supported

OAUTH2_ERROR_PERMISSION_DENIED 

Permission denied

OAUTH2_ERROR_PARSE_FAILED 

Response parse failed

OAUTH2_ERROR_NETWORK_ERROR 

Network error

OAUTH2_ERROR_SERVER 

Server error

OAUTH2_ERROR_USER_CANCELLED 

User cancelled the operation

OAUTH2_ERROR_VALUE_NOT_FOUND 

Value not found

OAUTH2_ERROR_UNKNOWN 

Unknown error

Enumerations to set grant_type.

Since :
2.4
See also:
oauth2_request_set_grant_type()
Enumerator:
OAUTH2_GRANT_TYPE_AUTH_CODE 

Access Token Request for Authorization Code Grant type.

OAUTH2_GRANT_TYPE_PASSWORD 

Access Token Request for Resource Owner Password Credentials Grant type.

OAUTH2_GRANT_TYPE_CLIENT_CREDENTIALS 

Access Token Request for Client Credentials Grant type.

OAUTH2_GRANT_TYPE_REFRESH 

Refresh Token Request.

Enumerations to set response_type.

Since :
2.4
See also:
oauth2_request_set_response_type()
Enumerator:
OAUTH2_RESPONSE_TYPE_CODE 

Requesting an authorization code as response type.

OAUTH2_RESPONSE_TYPE_TOKEN 

Requesting an access token(implicit grant) as response type.


Function Documentation

OAUTH2_API int oauth2_error_get_code ( oauth2_error_h  handle,
int *  server_error_code,
int *  platform_error_code 
)

Gets error code.

Since :
2.4
Remarks:
You must not release server_error_code and platform_error_code using free().
Parameters:
[in]handleThe error handle
[out]server_error_codeError code (if any) returned by the server
[out]platform_error_codeTizen platform related error code (if any), value is of type oauth2_error_e
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_error_get_custom_data ( oauth2_error_h  handle,
const char *  custom_key,
char **  custom_value 
)

Gets the custom data.

Since :
2.4
Remarks:
You must not release custom_value using free().
Parameters:
[in]handleThe error handle
[in]custom_keyThe custom key
[out]custom_valueThe custom value
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_error_get_description ( oauth2_error_h  handle,
char **  description 
)

Gets error description.

Since :
2.4
Remarks:
You must not release description using free().
Parameters:
[in]handleThe error handle
[out]descriptionThe Error description
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_error_get_uri ( oauth2_error_h  handle,
char **  uri 
)

Gets error uri.

Since :
2.4
Remarks:
You must not release uri using free().
Parameters:
[in]handleThe error handle
[out]uriThe Error URI
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_manager_clear_cache ( oauth2_manager_h  handle)

Clears the cache.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]handleThe oauth2 manager handle.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_PERMISSION_DENIEDPermission denied.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported.
OAUTH2_API int oauth2_manager_clear_cookies ( oauth2_manager_h  handle)

Clears the cookies.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Parameters:
[in]handleThe oauth2 manager handle.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_PERMISSION_DENIEDPermission denied.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported.
OAUTH2_API int oauth2_manager_create ( oauth2_manager_h handle)

Creates oauth2_manager_h handle.

Remarks:
The handle must be released using oauth2_manager_destroy().
Since :
2.4
Parameters:
[out]handleThe created handle
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
See also:
oauth2_manager_destroy()
OAUTH2_API int oauth2_manager_destroy ( oauth2_manager_h  handle)

Destroys oauth2_manager_h handle.

Since :
2.4
Parameters:
[in]handleThe oauth2 manager handle
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported

Returns whether oauth2_manager related request is pending.

Since :
2.4
Parameters:
[in]handleThe auth2 manager handle.
Return values:
falseNo pending request
trueThere is pending request.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_manager_refresh_access_token ( oauth2_manager_h  handle,
oauth2_request_h  request,
oauth2_refresh_token_cb  callback,
void *  user_data 
)

Requests a refresh token.

The response is delivered via oauth2_refresh_token_cb() callback.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Remarks:
The "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.
Parameters:
[in]handleThe oauth2 manager handle.
[in]requestThe request handle.
[in]callbackThe application callback.
[in]user_dataThe user data to be passed to the callback function.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of memory.
OAUTH2_ERROR_INVALID_PARAMETERInvalid input parameter(s) passed.
OAUTH2_ERROR_ALREADY_IN_PROGRESSThe previous request is already in progress.
OAUTH2_ERROR_PERMISSION_DENIEDPermission denied.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported.
OAUTH2_ERROR_PARSE_FAILEDParsing failed.
OAUTH2_ERROR_NETWORK_ERRORNetwork Error.
OAUTH2_ERROR_UNKNOWNUnknown system error.
See also:
oauth2_refresh_token_cb()
oauth2_manager_create()
oauth2_request_create()
OAUTH2_API int oauth2_manager_request_access_token ( oauth2_manager_h  handle,
oauth2_request_h  request,
oauth2_access_token_cb  callback,
void *  user_data 
)

Requests an access token.

The response is delivered via oauth2_access_token_cb() callback.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Remarks:
The "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.
Parameters:
[in]handleThe oauth2_manager handle.
[in]requestThe request handle.
[in]callbackThe application callback.
[in]user_dataThe user data to be passed to the callback function.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of memory.
OAUTH2_ERROR_INVALID_PARAMETERInvalid input parameter(s) passed.
OAUTH2_ERROR_ALREADY_IN_PROGRESSThe previous request is already in progress.
OAUTH2_ERROR_PERMISSION_DENIEDPermission denied.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported.
OAUTH2_ERROR_PARSE_FAILEDParsing failed.
OAUTH2_ERROR_NETWORK_ERRORNetwork Error.
OAUTH2_ERROR_UNKNOWNUnknown system error.
See also:
oauth2_access_token_cb()
oauth2_manager_create()
oauth2_request_create()
OAUTH2_API int oauth2_manager_request_authorization_grant ( oauth2_manager_h  handle,
oauth2_request_h  request,
oauth2_auth_grant_cb  callback,
void *  user_data 
)

Request authorization grant.

The response is delivered via oauth2_auth_grant_cb().

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Remarks:
The "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.
Parameters:
[in]handleThe oauth2_manager handle.
[in]requestThe request handle.
[in]callbackThe application callback.
[in]user_dataThe user data to be passed to the callback function.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of memory.
OAUTH2_ERROR_INVALID_PARAMETERInvalid input parameter(s) passed.
OAUTH2_ERROR_ALREADY_IN_PROGRESSThe previous request is already in progress.
OAUTH2_ERROR_PERMISSION_DENIEDPermission denied.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported.
OAUTH2_ERROR_PARSE_FAILEDParsing failed.
OAUTH2_ERROR_NETWORK_ERRORNetwork Error.
OAUTH2_ERROR_UNKNOWNUnknown system error.
See also:
oauth2_auth_grant_cb()
oauth2_manager_create()
oauth2_request_create()
OAUTH2_API int oauth2_manager_request_token ( oauth2_manager_h  handle,
oauth2_request_h  request,
oauth2_token_cb  callback,
void *  user_data 
)

Request OAuth 2.0 access token.

The response is delivered via oauth2_token_cb().

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
Remarks:
The "internet" privilege is required to call this API. Note, only one pending request is allowed.
Parameters:
[in]handleThe oauth2 manager handle.
[in]requestThe request handle.
[in]callbackThe callback to receive response.
[in]user_dataThe user data to be passed to the callback function.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of memory.
OAUTH2_ERROR_INVALID_PARAMETERInvalid input parameter(s) passed.
OAUTH2_ERROR_ALREADY_IN_PROGRESSThe previous request is already in progress.
OAUTH2_ERROR_PERMISSION_DENIEDPermission denied.
OAUTH2_ERROR_NOT_SUPPORTEDNot supported.
OAUTH2_ERROR_PARSE_FAILEDParsing failed.
OAUTH2_ERROR_NETWORK_ERRORNetwork Error.
OAUTH2_ERROR_UNKNOWNUnknown system error.
See also:
oauth2_token_cb()
oauth2_manager_create()
oauth2_request_create()
OAUTH2_API int oauth2_request_add_custom_data ( oauth2_request_h  handle,
const char *  key,
const char *  value 
)

Adds custom key-value pair to the request.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]keyThe key
[in]valueThe value
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
See also:
oauth2_request_get_custom_data()
OAUTH2_API int oauth2_request_create ( oauth2_request_h handle)

Creates oauth2_request_h handle.

The handle must be freed via oauth2_request_destroy().

Since :
2.4
Parameters:
[out]handleThe created oauth2_request handle, else NULL for error cases
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_destroy ( oauth2_request_h  handle)

Destroys oauth2_request_h handle.

Since :
2.4
Parameters:
[in]handleThe oauth2_request handle to destroy
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_auth_end_point_url ( oauth2_request_h  handle,
char **  url 
)

Gets authorization end point URL.

Since :
2.4
Remarks:
You must not release url using free().
Parameters:
[in]handleThe request handle
[out]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_authorization_code ( oauth2_request_h  handle,
char **  code 
)

Gets authorization code.

Since :
2.4
Remarks:
You must not release code using free().
Parameters:
[in]handleThe request handle.
[out]codeThe code.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_client_id ( oauth2_request_h  handle,
char **  client_id 
)

Gets client id.

Since :
2.4
Remarks:
You must not release client_id using free().
Parameters:
[in]handleThe request handle
[out]client_idThe client id
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_client_secret ( oauth2_request_h  handle,
char **  client_secret 
)

Gets client secret.

Since :
2.4
Remarks:
You must not release client_secret using free().
Parameters:
[in]handleThe request handle
[out]client_secretThe client_secret
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_custom_data ( oauth2_request_h  handle,
const char *  custom_key,
char **  custom_value 
)

Gets the custom value.

Since :
2.4
Remarks:
You must not release custom_value using free().
Parameters:
[in]handleThe request handle
[in]custom_keyThe custom key
[out]custom_valueThe custom value
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_grant_type ( oauth2_request_h  handle,
oauth2_grant_type_e grant_type 
)

Gets grant type.

Since :
2.4
Remarks:
You must not release grant_type using free().
Parameters:
[in]handleThe request handle
[out]grant_typeThe grant type
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_password ( oauth2_request_h  handle,
char **  password 
)

Gets password.

Since :
2.4
Remarks:
You must not release password using free().
Parameters:
[in]handleThe request handle
[out]passwordThe password
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_redirection_url ( oauth2_request_h  handle,
char **  url 
)

Gets redirection URL.

Since :
2.4
Remarks:
You must not release url using free().
Parameters:
[in]handleThe request handle
[out]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_refresh_token ( oauth2_request_h  handle,
char **  refresh_token 
)

Gets refresh token.

Since :
2.4
Remarks:
You must not release refresh_token using free().
Parameters:
[in]handleThe request handle
[out]refresh_tokenThe refresh token
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_refresh_token_url ( oauth2_request_h  handle,
char **  url 
)

Gets refresh token end point URL.

Since :
2.4
Remarks:
You must not release url using free().
Parameters:
[in]handleThe request handle
[out]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_response_type ( oauth2_request_h  handle,
oauth2_response_type_e response_type 
)

Gets response type.

Since :
2.4
Remarks:
You must not free response_type
Parameters:
[in]handleThe request handle
[out]response_typeThe response type
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_scope ( oauth2_request_h  handle,
char **  scope 
)

Gets scope.

Since :
2.4
Remarks:
You must not release scope using free().
Parameters:
[in]handleThe request handle
[out]scopeThe scope
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_state ( oauth2_request_h  handle,
char **  state 
)

Gets state.

Since :
2.4
Remarks:
You must not release state using free().
Parameters:
[in]handleThe request handle
[out]stateThe state
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_token_end_point_url ( oauth2_request_h  handle,
char **  url 
)

Gets access token end point URL.

Since :
2.4
Remarks:
You must not release url using free().
Parameters:
[in]handleThe request handle
[out]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_get_user_name ( oauth2_request_h  handle,
char **  user_name 
)

Gets user name.

Since :
2.4
Remarks:
You must not release user_name using free().
Parameters:
[in]handleThe request handle
[out]user_nameThe user name
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_auth_end_point_url ( oauth2_request_h  handle,
const char *  url 
)

Sets authorization end point URL.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_authorization_code ( oauth2_request_h  handle,
const char *  code 
)

Sets authorization code.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]codeThe authorization code
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
See also:
oauth2_response_get_authorization_code()

Sets client authentication type. Default is OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC.

Since :
2.4
Remarks:
Facebook and Google does not support HTTP Basic Authentication, instead they require client credentials to be sent via request body.
So application must set OAUTH2_CLIENT_AUTHENTICATION_TYPE_REQUEST_BODY for them.
Parameters:
[in]handleThe request handle
[in]client_auth_typeThe client authentication type
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_client_id ( oauth2_request_h  handle,
const char *  client_id 
)

Sets client id.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]client_idThe client id
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_client_secret ( oauth2_request_h  handle,
const char *  client_secret 
)

Sets client secret.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]client_secretThe secret
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_grant_type ( oauth2_request_h  handle,
oauth2_grant_type_e  grant_type 
)

Sets grant type.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]grant_typeThe grant type
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_password ( oauth2_request_h  handle,
const char *  password 
)

Sets password.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]passwordThe password
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_redirection_url ( oauth2_request_h  handle,
const char *  url 
)

Sets redirection URL.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_refresh_token ( oauth2_request_h  handle,
char *  refresh_token 
)

Sets refresh token. Used mostly while using oauth2_manager_refresh_access_token().

Since :
2.4
Parameters:
[in]handleThe request handle
[in]refresh_tokenThe refresh token string
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_refresh_token_url ( oauth2_request_h  handle,
const char *  url 
)

Sets refresh token end point URL.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_response_type ( oauth2_request_h  handle,
oauth2_response_type_e  response_type 
)

Sets response type.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]response_typeThe response type
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_scope ( oauth2_request_h  handle,
const char *  scope 
)

Sets scope.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]scopeThe scope
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_state ( oauth2_request_h  handle,
const char *  state 
)

Sets state.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]stateThe state
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_token_end_point_url ( oauth2_request_h  handle,
const char *  url 
)

Sets access token end point URL.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]urlThe url
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_request_set_user_name ( oauth2_request_h  handle,
const char *  user_name 
)

Sets user name.

Since :
2.4
Parameters:
[in]handleThe request handle
[in]user_nameThe user name
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_destroy ( oauth2_response_h  handle)

Destroys the received handle.

Since :
2.4
Parameters:
[in]handleThe response handle
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_access_token ( oauth2_response_h  handle,
char **  access_token 
)

Gets access token.

Since :
2.4
Remarks:
You must not release access_token using free().
Parameters:
[in]handleThe response handle
[out]access_tokenThe access token
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_authorization_code ( oauth2_response_h  handle,
char **  code 
)

Gets the authorization code.

Since :
2.4
Remarks:
You must not release code using free().
Parameters:
[in]handleThe response handle
[out]codeThe code.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
See also:
oauth2_request_set_authorization_code()
OAUTH2_API int oauth2_response_get_custom_data ( oauth2_response_h  handle,
const char *  custom_key,
char **  custom_value 
)

Gets the custom data.

Some service providers send additional keys not specified in OAuth 2.0 RFC. To get those additional fields this API needs to be used.

Since :
2.4
Remarks:
You must not release custom_value using free().
Parameters:
[in]handleThe response handle
[in]custom_keyThe custom key
[out]custom_valueThe custom value
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_error ( oauth2_response_h  handle,
oauth2_error_h error 
)

Gets error.

Since :
2.4
Remarks:
You must not release error using free().
Parameters:
[in]handleThe response handle
[out]errorThe error structure
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
See also:
oauth2_error_h
OAUTH2_API int oauth2_response_get_expires_in ( oauth2_response_h  handle,
long long *  expires_in 
)

Gets expiry time.

Since :
2.4
Remarks:
You must not release expires_in using free().
Parameters:
[in]handleThe response handle
[out]expires_inExpiry value
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_refresh_token ( oauth2_response_h  handle,
char **  refresh_token 
)

Gets refresh token.

Since :
2.4
Remarks:
You must not release refresh_token using free().
Parameters:
[in]handleThe response handle
[out]refresh_tokenThe refresh token
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_scope ( oauth2_response_h  handle,
char **  scope 
)

Gets scope.

Since :
2.4
Remarks:
You must not release scope using free().
Parameters:
[in]handleThe response handle
[out]scopeThe scope
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_state ( oauth2_response_h  handle,
char **  state 
)

Gets state.

Since :
2.4
Remarks:
You must not release state using free().
Parameters:
[in]handleThe response handle
[out]stateThe state.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported
OAUTH2_API int oauth2_response_get_token_type ( oauth2_response_h  handle,
char **  token_type 
)

Gets token type.

Since :
2.4
Remarks:
You must not release token_type using free().
Parameters:
[in]handleThe response handle
[out]token_typeThe token type
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_OUT_OF_MEMORYOut of Memory
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
OAUTH2_ERROR_VALUE_NOT_FOUNDValue not found
OAUTH2_ERROR_NOT_SUPPORTEDNot supported