Tizen Native API
3.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:
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 Element.
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.
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) |
Gets 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) |
Gets 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. |
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 :
- 3.0
- Parameters:
-
[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_access_token() must be called to get this callback invoked.
typedef void(* oauth2_auth_grant_cb)(oauth2_response_h response, void *user_data) |
Called when oauth2_manager_request_authorization_grant() response comes.
- Since :
- 3.0
- Parameters:
-
[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_authorization_grant() must be called to get this callback invoked.
typedef struct oauth2_error_s* oauth2_error_h |
The structure type for OAuth 2.0 Error handle.
- Since :
- 3.0
typedef struct oauth2_manager_s* oauth2_manager_h |
The structure type for OAuth 2.0 Manager handle.
- Since :
- 3.0
typedef void(* oauth2_refresh_token_cb)(oauth2_response_h response, void *user_data) |
Called when oauth2_manager_refresh_access_token() response comes.
- Since :
- 3.0
- Parameters:
-
[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_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 :
- 3.0
typedef struct oauth2_response_s* oauth2_response_h |
The structure type for OAuth 2.0 Response handle.
- Since :
- 3.0
typedef void(* oauth2_token_cb)(oauth2_response_h response, void *user_data) |
Called when the oauth2_manager_request_token() resopnse comes.
- Since :
- 3.0 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 :
- 3.0
- 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)
enum oauth2_error_e |
Enumerations of error codes for oauth2 APIs.
- Since :
- 3.0
- Enumerator:
enum oauth2_grant_type_e |
Enumerations to set grant_type.
- Since :
- 3.0
- See also:
- oauth2_request_set_grant_type()
- Enumerator:
Function Documentation
int oauth2_error_get_code | ( | oauth2_error_h | handle, |
int * | server_error_code, | ||
int * | platform_error_code | ||
) |
Gets error code.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free server_error_code and platform_error_code
- Parameters:
-
[in] handle The error handle. [out] server_error_code Error code (if any) returned by the server. [out] platform_error_code Tizen 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_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_error_get_custom_data | ( | oauth2_error_h | handle, |
const char * | custom_key, | ||
char ** | custom_value | ||
) |
Gets the custom data.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free custom_value
- Parameters:
-
[in] handle The error handle. [in] custom_key The custom key. [out] custom_value The custom value.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_error_get_description | ( | oauth2_error_h | handle, |
char ** | description | ||
) |
Gets error description.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free description
- Parameters:
-
[in] handle The error handle. [out] description The Error description.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_error_get_uri | ( | oauth2_error_h | handle, |
char ** | uri | ||
) |
Gets error uri.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free uri
- Parameters:
-
[in] handle The error handle. [out] uri The Error URI.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_manager_clear_cache | ( | oauth2_manager_h | handle | ) |
Clears the cache.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The oauth2_manager handle.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_PERMISSION_DENIED Permission denied. OAUTH2_ERROR_NOT_SUPPORTED Not supported.
int oauth2_manager_clear_cookies | ( | oauth2_manager_h | handle | ) |
Clears the cookies.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The oauth2_manager handle.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_PERMISSION_DENIED Permission denied. OAUTH2_ERROR_NOT_SUPPORTED Not supported.
int oauth2_manager_create | ( | oauth2_manager_h * | handle | ) |
Creates oauth2_manager_h handle.
- Remarks:
- It must be freed using oauth2_manager_destroy().
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[out] handle The created handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- oauth2_manager_destroy()
int oauth2_manager_destroy | ( | oauth2_manager_h | handle | ) |
Destroys oauth2_manager_h handle.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The oauth2_manager handle.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
bool oauth2_manager_is_request_in_progress | ( | oauth2_manager_h | handle | ) |
Returns whether oauth2_manager related request is pending.
- Since :
- 3.0
- Parameters:
-
[in] handle The auth2_manager handle.
- Return values:
-
false No pending request true There 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 :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The oauth2_manager handle. [in] request The request handle. [in] callback The application callback. [in] user_data The user data to be passed to the callback function.
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of memory. OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed. OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress. OAUTH2_ERROR_PERMISSION_DENIED Permission denied. OAUTH2_ERROR_NOT_SUPPORTED Not supported. OAUTH2_ERROR_PARSE_FAILED Parsing failed. OAUTH2_ERROR_NETWORK_ERROR Network Error. OAUTH2_ERROR_UNKNOWN Unknown system error.
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 :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The oauth2_manager handle. [in] request The request handle. [in] callback The application callback. [in] user_data The user data to be passed to the callback function.
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of memory. OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed. OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress. OAUTH2_ERROR_PERMISSION_DENIED Permission denied. OAUTH2_ERROR_NOT_SUPPORTED Not supported. OAUTH2_ERROR_PARSE_FAILED Parsing failed. OAUTH2_ERROR_NETWORK_ERROR Network Error. OAUTH2_ERROR_UNKNOWN Unknown system error.
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 :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The oauth2_manager handle. [in] request The request handle. [in] callback The application callback. [in] user_data The user data to be passed to the callback function.
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of memory. OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed. OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress. OAUTH2_ERROR_PERMISSION_DENIED Permission denied. OAUTH2_ERROR_NOT_SUPPORTED Not supported. OAUTH2_ERROR_PARSE_FAILED Parsing failed. OAUTH2_ERROR_NETWORK_ERROR Network Error. OAUTH2_ERROR_UNKNOWN Unknown system error.
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 :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/internet
- Parameters:
-
[in] handle The oauth2_manager_handle. [in] request The request handle. [in] callback The callback to receive response. [in] user_data The user data to be passed to the callback function.
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of memory. OAUTH2_ERROR_INVALID_PARAMETER Invalid input parameter(s) passed. OAUTH2_ERROR_ALREADY_IN_PROGRESS The previous request is already in progress. OAUTH2_ERROR_PERMISSION_DENIED Permission denied. OAUTH2_ERROR_NOT_SUPPORTED Not supported. OAUTH2_ERROR_PARSE_FAILED Parsing failed. OAUTH2_ERROR_NETWORK_ERROR Network Error. OAUTH2_ERROR_UNKNOWN Unknown system error.
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 :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] key The key. [in] value The value.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- oauth2_request_get_custom_data()
int oauth2_request_create | ( | oauth2_request_h * | handle | ) |
Creates oauth2_request_h handle.
The handle must be freed via oauth2_request_destroy().
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[out] handle The created oauth2_request handle, else NULL for error cases.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_destroy | ( | oauth2_request_h | handle | ) |
Destroys oauth2_request_h handle.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The oauth2_request handle to destory.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_get_auth_end_point_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets authorization end point URL.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free url
- Parameters:
-
[in] handle The request handle. [out] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_authorization_code | ( | oauth2_request_h | handle, |
char ** | code | ||
) |
Gets authorization code.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free code
- Parameters:
-
[in] handle The request handle. [out] code The code.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_client_id | ( | oauth2_request_h | handle, |
char ** | client_id | ||
) |
Gets client id.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free client_id
- Parameters:
-
[in] handle The request handle. [out] client_id The client id.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_client_secret | ( | oauth2_request_h | handle, |
char ** | client_secret | ||
) |
Gets client secret.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free client_secret
- Parameters:
-
[in] handle The request handle. [out] client_secret The client_secret.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_custom_data | ( | oauth2_request_h | handle, |
const char * | custom_key, | ||
char ** | custom_value | ||
) |
Gets the custom value.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free custom_value
- Parameters:
-
[in] handle The request handle. [in] custom_key The custom key. [out] custom_value The custom value.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_grant_type | ( | oauth2_request_h | handle, |
oauth2_grant_type_e * | grant_type | ||
) |
Gets grant type.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free grant_type
- Parameters:
-
[in] handle The request handle. [out] grant_type The grant type.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_password | ( | oauth2_request_h | handle, |
char ** | password | ||
) |
Gets password.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free password
- Parameters:
-
[in] handle The request handle. [out] password The password.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_redirection_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets redirection URL.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free url
- Parameters:
-
[in] handle The request handle. [out] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_refresh_token | ( | oauth2_request_h | handle, |
char ** | refresh_token | ||
) |
Gets refresh token.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free refresh_token
- Parameters:
-
[in] handle The request handle. [out] refresh_token The refresh token.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_refresh_token_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets refresh token end point URL.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free url
- Parameters:
-
[in] handle The request handle. [out] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_response_type | ( | oauth2_request_h | handle, |
oauth2_response_type_e * | response_type | ||
) |
Gets response type.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free response_type
- Parameters:
-
[in] handle The request handle. [out] response_type The respose type.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_scope | ( | oauth2_request_h | handle, |
char ** | scope | ||
) |
Gets scope.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free scope
- Parameters:
-
[in] handle The request handle. [out] scope The scope.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_state | ( | oauth2_request_h | handle, |
char ** | state | ||
) |
Gets state.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free state
- Parameters:
-
[in] handle The request handle. [out] state The state.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_token_end_point_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets access token end point URL.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free url
- Parameters:
-
[in] handle The request handle. [out] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_get_user_name | ( | oauth2_request_h | handle, |
char ** | user_name | ||
) |
Gets user name.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free user_name
- Parameters:
-
[in] handle The request handle. [out] user_name The user name.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_request_set_auth_end_point_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets authorization end point URL.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_authorization_code | ( | oauth2_request_h | handle, |
const char * | code | ||
) |
Sets authorization code.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] code The authorization code.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
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.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] client_auth_type The client authentication type.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid 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 :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] client_id The client id.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_client_secret | ( | oauth2_request_h | handle, |
const char * | client_secret | ||
) |
Sets client secret.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] client_secret The secret.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_grant_type | ( | oauth2_request_h | handle, |
oauth2_grant_type_e | grant_type | ||
) |
Sets grant type.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] grant_type The grant type.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_password | ( | oauth2_request_h | handle, |
const char * | password | ||
) |
Sets password.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] password The password.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_redirection_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets redirection URL.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid 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 :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] refresh_token The refresh token string.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_refresh_token_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets refresh token end point URL.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_response_type | ( | oauth2_request_h | handle, |
oauth2_response_type_e | response_type | ||
) |
Sets response type.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] response_type The response type.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_scope | ( | oauth2_request_h | handle, |
const char * | scope | ||
) |
Sets scope.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] scope The scope.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_state | ( | oauth2_request_h | handle, |
const char * | state | ||
) |
Sets state.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] state The state.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_token_end_point_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets access token end point URL.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] url The url.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_request_set_user_name | ( | oauth2_request_h | handle, |
const char * | user_name | ||
) |
Sets user name.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The request handle. [in] user_name The user name.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_response_destroy | ( | oauth2_response_h | handle | ) |
Destroys the received oauth2_response_h handle.
- Since :
- 3.0
- Privilege Level:
- public
- Parameters:
-
[in] handle The response handle.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter
int oauth2_response_get_access_token | ( | oauth2_response_h | handle, |
char ** | access_token | ||
) |
Gets access token.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free access_token
- Parameters:
-
[in] handle The response handle. [out] access_token The access token.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_response_get_authorization_code | ( | oauth2_response_h | handle, |
char ** | code | ||
) |
Gets the authorization code.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free code
- Parameters:
-
[in] handle The response handle. [out] code The code.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
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 :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free custom_value
- Parameters:
-
[in] handle The response handle. [in] custom_key The custom key. [out] custom_value The custom value.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_response_get_error | ( | oauth2_response_h | handle, |
oauth2_error_h * | error | ||
) |
Gets error.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free error
- Parameters:
-
[in] handle The response handle. [out] error The error structure.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
- See also:
- oauth2_error_h
- Since :
- 3.0
int oauth2_response_get_expires_in | ( | oauth2_response_h | handle, |
long long * | expires_in | ||
) |
Gets expiry time.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free expires_in
- Parameters:
-
[in] handle The response handle. [out] expires_in Expiry value.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_response_get_refresh_token | ( | oauth2_response_h | handle, |
char ** | refresh_token | ||
) |
Gets refresh token.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free refresh_token
- Parameters:
-
[in] handle The response handle. [out] refresh_token The refresh token.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_response_get_scope | ( | oauth2_response_h | handle, |
char ** | scope | ||
) |
Gets scope.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free scope
- Parameters:
-
[in] handle The response handle. [out] scope The scope.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_response_get_state | ( | oauth2_response_h | handle, |
char ** | state | ||
) |
Gets state.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free state
- Parameters:
-
[in] handle The response handle. [out] state The state.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found
int oauth2_response_get_token_type | ( | oauth2_response_h | handle, |
char ** | token_type | ||
) |
Gets token type.
- Since :
- 3.0
- Privilege Level:
- public
- Remarks:
- You must not free token_type
- Parameters:
-
[in] handle The response handle. [out] token_type The token type.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
OAUTH2_ERROR_NONE Successful OAUTH2_ERROR_OUT_OF_MEMORY Out of Memory OAUTH2_ERROR_INVALID_PARAMETER Invalid parameter OAUTH2_ERROR_VALUE_NOT_FOUND Value not found