Tizen Native API
5.0
|
The OAuth 2.0 APIs provide easy way to gain access token between server and client.
#include <oauth2.h>
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.
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 List.a>
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 void(* oauth2_access_token_cb)(oauth2_response_h response, void *user_data) |
Called when oauth2_manager_request_access_token() response comes.
[in] | response | The response. The response must be released using oauth2_response_destroy(). |
[in] | user_data | The user data passed from the callback function. |
typedef void(* oauth2_auth_grant_cb)(oauth2_response_h response, void *user_data) |
Called when oauth2_manager_request_authorization_grant() response comes.
[in] | response | The response. The response must be released using oauth2_response_destroy(). |
[in] | user_data | The user data passed from the callback function. |
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_refresh_token_cb)(oauth2_response_h response, void *user_data) |
Called when oauth2_manager_refresh_access_token() response comes.
[in] | response | The response. The response must be released using oauth2_response_destroy(). |
[in] | user_data | The user data passed from the callback function. |
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 void(* oauth2_token_cb)(oauth2_response_h response, void *user_data) |
Called when the oauth2_manager_request_token() response comes.
[in] | response | The response |
[in] | user_data | The user data passed from the callback function |
Enumerations for Client authentication scheme, used to sign client id and client secret accordingly.
enum oauth2_error_e |
Enumerations of error codes for oauth2 APIs.
enum oauth2_grant_type_e |
Enumerations to set grant_type.
OAUTH2_API int oauth2_error_get_code | ( | oauth2_error_h | handle, |
int * | server_error_code, | ||
int * | platform_error_code | ||
) |
Gets error code.
[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 |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_error_get_custom_data | ( | oauth2_error_h | handle, |
const char * | custom_key, | ||
char ** | custom_value | ||
) |
Gets the custom data.
[in] | handle | The error handle |
[in] | custom_key | The custom key |
[out] | custom_value | The custom value |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_error_get_description | ( | oauth2_error_h | handle, |
char ** | description | ||
) |
Gets error description.
[in] | handle | The error handle |
[out] | description | The Error description |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_error_get_uri | ( | oauth2_error_h | handle, |
char ** | uri | ||
) |
Gets error uri.
[in] | handle | The error handle |
[out] | uri | The Error URI |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_manager_clear_cache | ( | oauth2_manager_h | handle | ) |
Clears the cache.
[in] | handle | The oauth2 manager handle. |
0
on success, otherwise a negative error value 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. |
OAUTH2_API int oauth2_manager_clear_cookies | ( | oauth2_manager_h | handle | ) |
Clears the cookies.
[in] | handle | The oauth2 manager handle. |
0
on success, otherwise a negative error value 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. |
OAUTH2_API int oauth2_manager_create | ( | oauth2_manager_h * | handle | ) |
Creates oauth2_manager_h handle.
[out] | handle | The created handle |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_manager_destroy | ( | oauth2_manager_h | handle | ) |
Destroys oauth2_manager_h handle.
[in] | handle | The oauth2 manager handle |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API bool oauth2_manager_is_request_in_progress | ( | oauth2_manager_h | handle | ) |
Returns whether oauth2_manager related request is pending.
[in] | handle | The auth2 manager handle. |
false | No pending request |
true | There is pending request. |
OAUTH2_ERROR_NOT_SUPPORTED | Not 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.
[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. |
0
on success, otherwise a negative error value 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. |
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.
[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. |
0
on success, otherwise a negative error value 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. |
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().
[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. |
0
on success, otherwise a negative error value 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. |
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().
[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. |
0
on success, otherwise a negative error value 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. |
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.
[in] | handle | The request handle |
[in] | key | The key |
[in] | value | The value |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_create | ( | oauth2_request_h * | handle | ) |
Creates oauth2_request_h handle.
The handle must be freed via oauth2_request_destroy().
[out] | handle | The created oauth2_request handle, else NULL for error cases |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_destroy | ( | oauth2_request_h | handle | ) |
Destroys oauth2_request_h handle.
[in] | handle | The oauth2_request handle to destroy |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_auth_end_point_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets authorization end point URL.
[in] | handle | The request handle |
[out] | url | The url |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_authorization_code | ( | oauth2_request_h | handle, |
char ** | code | ||
) |
Gets authorization code.
[in] | handle | The request handle. |
[out] | code | The code. |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_client_id | ( | oauth2_request_h | handle, |
char ** | client_id | ||
) |
Gets client id.
[in] | handle | The request handle |
[out] | client_id | The client id |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_client_secret | ( | oauth2_request_h | handle, |
char ** | client_secret | ||
) |
Gets client secret.
[in] | handle | The request handle |
[out] | client_secret | The client_secret |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_custom_data | ( | oauth2_request_h | handle, |
const char * | custom_key, | ||
char ** | custom_value | ||
) |
Gets the custom value.
[in] | handle | The request handle |
[in] | custom_key | The custom key |
[out] | custom_value | The custom value |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_grant_type | ( | oauth2_request_h | handle, |
oauth2_grant_type_e * | grant_type | ||
) |
Gets grant type.
[in] | handle | The request handle |
[out] | grant_type | The grant type |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_password | ( | oauth2_request_h | handle, |
char ** | password | ||
) |
Gets password.
[in] | handle | The request handle |
[out] | password | The password |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_redirection_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets redirection URL.
[in] | handle | The request handle |
[out] | url | The url |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_refresh_token | ( | oauth2_request_h | handle, |
char ** | refresh_token | ||
) |
Gets refresh token.
[in] | handle | The request handle |
[out] | refresh_token | The refresh token |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_refresh_token_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets refresh token end point URL.
[in] | handle | The request handle |
[out] | url | The url |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_response_type | ( | oauth2_request_h | handle, |
oauth2_response_type_e * | response_type | ||
) |
Gets response type.
[in] | handle | The request handle |
[out] | response_type | The response type |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_scope | ( | oauth2_request_h | handle, |
char ** | scope | ||
) |
Gets scope.
[in] | handle | The request handle |
[out] | scope | The scope |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_state | ( | oauth2_request_h | handle, |
char ** | state | ||
) |
Gets state.
[in] | handle | The request handle |
[out] | state | The state |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_token_end_point_url | ( | oauth2_request_h | handle, |
char ** | url | ||
) |
Gets access token end point URL.
[in] | handle | The request handle |
[out] | url | The url |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_get_user_name | ( | oauth2_request_h | handle, |
char ** | user_name | ||
) |
Gets user name.
[in] | handle | The request handle |
[out] | user_name | The user name |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_auth_end_point_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets authorization end point URL.
[in] | handle | The request handle |
[in] | url | The url |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_authorization_code | ( | oauth2_request_h | handle, |
const char * | code | ||
) |
Sets authorization code.
[in] | handle | The request handle |
[in] | code | The authorization code |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
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.
[in] | handle | The request handle |
[in] | client_auth_type | The client authentication type |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_client_id | ( | oauth2_request_h | handle, |
const char * | client_id | ||
) |
Sets client id.
[in] | handle | The request handle |
[in] | client_id | The client id |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_client_secret | ( | oauth2_request_h | handle, |
const char * | client_secret | ||
) |
Sets client secret.
[in] | handle | The request handle |
[in] | client_secret | The secret |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_grant_type | ( | oauth2_request_h | handle, |
oauth2_grant_type_e | grant_type | ||
) |
Sets grant type.
[in] | handle | The request handle |
[in] | grant_type | The grant type |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_password | ( | oauth2_request_h | handle, |
const char * | password | ||
) |
Sets password.
[in] | handle | The request handle |
[in] | password | The password |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_redirection_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets redirection URL.
[in] | handle | The request handle |
[in] | url | The url |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not 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().
[in] | handle | The request handle |
[in] | refresh_token | The refresh token string |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_refresh_token_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets refresh token end point URL.
[in] | handle | The request handle |
[in] | url | The url |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_response_type | ( | oauth2_request_h | handle, |
oauth2_response_type_e | response_type | ||
) |
Sets response type.
[in] | handle | The request handle |
[in] | response_type | The response type |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_scope | ( | oauth2_request_h | handle, |
const char * | scope | ||
) |
Sets scope.
[in] | handle | The request handle |
[in] | scope | The scope |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_state | ( | oauth2_request_h | handle, |
const char * | state | ||
) |
Sets state.
[in] | handle | The request handle |
[in] | state | The state |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_token_end_point_url | ( | oauth2_request_h | handle, |
const char * | url | ||
) |
Sets access token end point URL.
[in] | handle | The request handle |
[in] | url | The url |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_request_set_user_name | ( | oauth2_request_h | handle, |
const char * | user_name | ||
) |
Sets user name.
[in] | handle | The request handle |
[in] | user_name | The user name |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_OUT_OF_MEMORY | Out of Memory |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_destroy | ( | oauth2_response_h | handle | ) |
Destroys the received handle.
[in] | handle | The response handle |
0
on success, otherwise a negative error value OAUTH2_ERROR_NONE | Successful |
OAUTH2_ERROR_INVALID_PARAMETER | Invalid parameter |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_access_token | ( | oauth2_response_h | handle, |
char ** | access_token | ||
) |
Gets access token.
[in] | handle | The response handle |
[out] | access_token | The access token |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_authorization_code | ( | oauth2_response_h | handle, |
char ** | code | ||
) |
Gets the authorization code.
[in] | handle | The response handle |
[out] | code | The code. |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
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.
[in] | handle | The response handle |
[in] | custom_key | The custom key |
[out] | custom_value | The custom value |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_error | ( | oauth2_response_h | handle, |
oauth2_error_h * | error | ||
) |
Gets error.
[in] | handle | The response handle |
[out] | error | The error structure |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_expires_in | ( | oauth2_response_h | handle, |
long long * | expires_in | ||
) |
Gets expiry time.
[in] | handle | The response handle |
[out] | expires_in | Expiry value |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_refresh_token | ( | oauth2_response_h | handle, |
char ** | refresh_token | ||
) |
Gets refresh token.
[in] | handle | The response handle |
[out] | refresh_token | The refresh token |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_scope | ( | oauth2_response_h | handle, |
char ** | scope | ||
) |
Gets scope.
[in] | handle | The response handle |
[out] | scope | The scope |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_state | ( | oauth2_response_h | handle, |
char ** | state | ||
) |
Gets state.
[in] | handle | The response handle |
[out] | state | The state. |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |
OAUTH2_API int oauth2_response_get_token_type | ( | oauth2_response_h | handle, |
char ** | token_type | ||
) |
Gets token type.
[in] | handle | The response handle |
[out] | token_type | The token type |
0
on success, otherwise a negative error value 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 |
OAUTH2_ERROR_NOT_SUPPORTED | Not supported |