Tizen Native API

Functions

int oauth2_error_get_code (oauth2_error_h handle, int *server_error_code, int *platform_error_code)
 Gets error code.
int oauth2_error_get_description (oauth2_error_h handle, char **description)
 Gets error description.
int oauth2_error_get_uri (oauth2_error_h handle, char **uri)
 Gets error uri.
int oauth2_error_get_custom_data (oauth2_error_h handle, const char *custom_key, char **custom_value)
 Gets the custom data.
int oauth2_manager_create (oauth2_manager_h *handle)
 Creates oauth2_manager_h handle.
int oauth2_manager_destroy (oauth2_manager_h handle)
 Destroys oauth2_manager_h handle.
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.
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.
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.
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.
bool oauth2_manager_is_request_in_progress (oauth2_manager_h handle)
 Returns whether oauth2_manager related request is pending.
int oauth2_manager_clear_cookies (oauth2_manager_h handle)
 Clears the cookies.
int oauth2_manager_clear_cache (oauth2_manager_h handle)
 Clears the cache.
int oauth2_request_create (oauth2_request_h *handle)
 Creates oauth2_request_h handle.
int oauth2_request_destroy (oauth2_request_h handle)
 Destroys oauth2_request_h handle.
int oauth2_request_set_auth_end_point_url (oauth2_request_h handle, const char *url)
 Sets authorization end point URL.
int oauth2_request_set_token_end_point_url (oauth2_request_h handle, const char *url)
 Sets access token end point URL.
int oauth2_request_set_redirection_url (oauth2_request_h handle, const char *url)
 Sets redirection URL.
int oauth2_request_set_refresh_token_url (oauth2_request_h handle, const char *url)
 Sets refresh token end point URL.
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().
int oauth2_request_set_response_type (oauth2_request_h handle, oauth2_response_type_e response_type)
 Sets response type.
int oauth2_request_set_client_id (oauth2_request_h handle, const char *client_id)
 Sets client id.
int oauth2_request_set_client_secret (oauth2_request_h handle, const char *client_secret)
 Sets client secret.
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.
int oauth2_request_set_scope (oauth2_request_h handle, const char *scope)
 Sets scope.
int oauth2_request_set_state (oauth2_request_h handle, const char *state)
 Sets state.
int oauth2_request_set_grant_type (oauth2_request_h handle, oauth2_grant_type_e grant_type)
 Sets grant type.
int oauth2_request_set_authorization_code (oauth2_request_h handle, const char *code)
 Sets authorization code.
int oauth2_request_set_user_name (oauth2_request_h handle, const char *user_name)
 Sets user name.
int oauth2_request_set_password (oauth2_request_h handle, const char *password)
 Sets password.
int oauth2_request_add_custom_data (oauth2_request_h handle, const char *key, const char *value)
 Adds custom key-value pair to the request.
int oauth2_request_get_auth_end_point_url (oauth2_request_h handle, char **url)
 Gets authorization end point URL.
int oauth2_request_get_token_end_point_url (oauth2_request_h handle, char **url)
 Gets access token end point URL.
int oauth2_request_get_redirection_url (oauth2_request_h handle, char **url)
 Gets redirection URL.
int oauth2_request_get_refresh_token_url (oauth2_request_h handle, char **url)
 Gets refresh token end point URL.
int oauth2_request_get_refresh_token (oauth2_request_h handle, char **refresh_token)
 Sets refresh token.
int oauth2_request_get_response_type (oauth2_request_h handle, oauth2_response_type_e *response_type)
 Gets response type.
int oauth2_request_get_client_id (oauth2_request_h handle, char **client_id)
 Gets client id.
int oauth2_request_get_client_secret (oauth2_request_h handle, char **client_secret)
 Gets client secret.
int oauth2_request_get_scope (oauth2_request_h handle, char **scope)
 Gets scope.
int oauth2_request_get_state (oauth2_request_h handle, char **state)
 Gets state.
int oauth2_request_get_grant_type (oauth2_request_h handle, oauth2_grant_type_e *grant_type)
 Gets grant type.
int oauth2_request_get_authorization_code (oauth2_request_h handle, char **code)
 Get authorization code.
int oauth2_request_get_user_name (oauth2_request_h handle, char **user_name)
 Gets user name.
int oauth2_request_get_password (oauth2_request_h handle, char **password)
 Gets password.
int oauth2_request_get_custom_data (oauth2_request_h handle, const char *custom_key, char **custom_value)
 Gets the custom value.
int oauth2_response_destroy (oauth2_response_h handle)
 Destroys the received oauth2_response_h handle.
int oauth2_response_get_authorization_code (oauth2_response_h handle, char **code)
 Gets the authorization code.
int oauth2_response_get_state (oauth2_response_h handle, char **state)
 Gets state.
int oauth2_response_get_access_token (oauth2_response_h handle, char **access_token)
 Gets access token.
int oauth2_response_get_token_type (oauth2_response_h handle, char **token_type)
 Gets token type.
int oauth2_response_get_expires_in (oauth2_response_h handle, long long *expires_in)
 Gets expiry time.
int oauth2_response_get_refresh_token (oauth2_response_h handle, char **refresh_token)
 Gets refresh token.
int oauth2_response_get_scope (oauth2_response_h handle, char **scope)
 Gets scope.
int oauth2_response_get_error (oauth2_response_h handle, oauth2_error_h *error)
 Gets error.
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() resopnse 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.

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.

Tizen OAuth 2.0 Authorization Framework. Refer to http://tools.ietf.org/html/rfc6749 about OAuth 2.0. Also service provider document needs to be referred for using end points and additional parameters.


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(). param[in] user_data The 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(). param[in] user_data The 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(). param[in] user_data The 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() resopnse comes.

Since :
2.4

param[in] response The response. The response must be released using oauth2_response_destroy(). param[in] user_data The 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 (http://tools.ietf.org/html/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

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 free server_error_code and platform_error_code
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
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 free custom_value
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
int oauth2_error_get_description ( oauth2_error_h  handle,
char **  description 
)

Gets error description.

Since :
2.4
Remarks:
You must not free description
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
int oauth2_error_get_uri ( oauth2_error_h  handle,
char **  uri 
)

Gets error uri.

Since :
2.4
Remarks:
You must not free uri
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

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.

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.

Creates oauth2_manager_h handle.

Remarks:
It must be freed 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
See also:
oauth2_manager_destroy()

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

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.
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. "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
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.
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()
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. "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
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.
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()
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(). "internet" privilege is required to call this API. Note, only one pending request is allowed at a time.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
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.
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()
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(). "internet" privilege is required to call this API. Note, only one pending request is allowed.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/internet
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.
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()
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
See also:
oauth2_request_get_custom_data()

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

Destroys oauth2_request_h handle.

Since :
2.4
Parameters:
[in]handleThe oauth2_request handle to destory.
Returns:
0 on success, otherwise a negative error value
Return values:
OAUTH2_ERROR_NONESuccessful
OAUTH2_ERROR_INVALID_PARAMETERInvalid parameter
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 free url
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
int oauth2_request_get_authorization_code ( oauth2_request_h  handle,
char **  code 
)

Get authorization code.

Since :
2.4
Remarks:
You must not free code
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
int oauth2_request_get_client_id ( oauth2_request_h  handle,
char **  client_id 
)

Gets client id.

Since :
2.4
Remarks:
You must not free client_id
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
int oauth2_request_get_client_secret ( oauth2_request_h  handle,
char **  client_secret 
)

Gets client secret.

Since :
2.4
Remarks:
You must not free client_secret
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
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 free custom_value
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

Gets grant type.

Since :
2.4
Remarks:
You must not free grant_type
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
int oauth2_request_get_password ( oauth2_request_h  handle,
char **  password 
)

Gets password.

Since :
2.4
Remarks:
You must not free password
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
int oauth2_request_get_redirection_url ( oauth2_request_h  handle,
char **  url 
)

Gets redirection URL.

Since :
2.4
Remarks:
You must not free url
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
int oauth2_request_get_refresh_token ( oauth2_request_h  handle,
char **  refresh_token 
)

Sets refresh token.

Since :
2.4
Remarks:
You must not free refresh_token
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
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 free url
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

Gets response type.

Since :
2.4
Remarks:
You must not free response_type
Parameters:
[in]handleThe request handle.
[out]response_typeThe respose 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
int oauth2_request_get_scope ( oauth2_request_h  handle,
char **  scope 
)

Gets scope.

Since :
2.4
Remarks:
You must not free scope
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
int oauth2_request_get_state ( oauth2_request_h  handle,
char **  state 
)

Gets state.

Since :
2.4
Remarks:
You must not free state
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
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 free url
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
int oauth2_request_get_user_name ( oauth2_request_h  handle,
char **  user_name 
)

Gets user name.

Since :
2.4
Remarks:
You must not free user_name
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
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
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]authorization_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
See also:
oauth2_response_get_authorization_code()

Sets client authentication type. Default is OAUTH2_CLIENT_AUTHENTICATION_TYPE_BASIC.

Since :
2.4
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
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.
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
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

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
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
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
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
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

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
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
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
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
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

Destroys the received oauth2_response_h 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
int oauth2_response_get_access_token ( oauth2_response_h  handle,
char **  access_token 
)

Gets access token.

Since :
2.4
Remarks:
You must not free access_token
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
int oauth2_response_get_authorization_code ( oauth2_response_h  handle,
char **  code 
)

Gets the authorization code.

Since :
2.4
Remarks:
You must not free code
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
See also:
oauth2_request_set_authorization_code()
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 free custom_value
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

Gets error.

Since :
2.4
Remarks:
You must not free error
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
See also:
Since :
2.4
int oauth2_response_get_expires_in ( oauth2_response_h  handle,
long long *  expires_in 
)

Gets expiry time.

Since :
2.4
Remarks:
You must not free expires_in
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
int oauth2_response_get_refresh_token ( oauth2_response_h  handle,
char **  refresh_token 
)

Gets refresh token.

Since :
2.4
Remarks:
You must not free refresh_token
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
int oauth2_response_get_scope ( oauth2_response_h  handle,
char **  scope 
)

Gets scope.

Since :
2.4
Remarks:
You must not free scope
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
int oauth2_response_get_state ( oauth2_response_h  handle,
char **  state 
)

Gets state.

Since :
2.4
Remarks:
You must not free state
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
int oauth2_response_get_token_type ( oauth2_response_h  handle,
char **  token_type 
)

Gets token type.

Since :
2.4
Remarks:
You must not free token_type
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