32#ifndef PROTOCORE_OAUTH2_H
33#define PROTOCORE_OAUTH2_H
37#if PROTOCORE_ENABLE_OAUTH2
41#ifndef PROTOCORE_OAUTH2_TOKEN_TYPE_LEN
42#define PROTOCORE_OAUTH2_TOKEN_TYPE_LEN 24
48 char access_token[PROTOCORE_OAUTH2_TOKEN_LEN];
49 char id_token[PROTOCORE_OAUTH2_TOKEN_LEN];
52 char refresh_token[PROTOCORE_OAUTH2_RT_LEN];
53 char token_type[PROTOCORE_OAUTH2_TOKEN_TYPE_LEN];
60 PROTOCORE_OAUTH2_ERR_BUILD = -1,
61 PROTOCORE_OAUTH2_ERR_TRANSPORT = -2,
62 PROTOCORE_OAUTH2_ERR_RESPONSE = -3,
73 const char *client_id;
74 const char *client_secret;
81 const char *redirect_uri;
82 const char *code_verifier;
88 const char *refresh_token;
94 const char *token_endpoint;
103 Oauth2Tokens *tokens;
135 Oauth2ClientArgs client;
136 Oauth2CodeGrantArgs code_grant;
137 Oauth2RefreshArgs refresh_grant;
138 Oauth2RequestArgs request;
139 Oauth2ResponseArgs response;
142#if PROTOCORE_ENABLE_HTTP_CLIENT
147extern Oauth2Vars Oauth2V;
152 void (*
const build_code_request)(uint8_t *work);
153 void (*
const build_refresh_request)(uint8_t *work);
154 void (*
const parse_token_response)(uint8_t *work);
155 void (*
const exchange_code)(uint8_t *work);
156 void (*
const refresh)(uint8_t *work);
161void protocore_oauth2_build_code_request(uint8_t *work);
162void protocore_oauth2_build_refresh_request(uint8_t *work);
163void protocore_oauth2_parse_token_response(uint8_t *work);
164void protocore_oauth2_exchange_code(uint8_t *work);
165void protocore_oauth2_refresh(uint8_t *work);
171static const Oauth2Ns Oauth2 __attribute__((unused)) = {
172 .build_code_request = protocore_oauth2_build_code_request,
173 .build_refresh_request = protocore_oauth2_build_refresh_request,
174 .parse_token_response = protocore_oauth2_parse_token_response,
175 .exchange_code = protocore_oauth2_exchange_code,
176 .refresh = protocore_oauth2_refresh,
188#if PROTOCORE_ENABLE_HTTP_CLIENT
189uint8_t *protocore_oauth2_span(
void);
PROTO_ENUM_PACKED
Application protocol spoken on a listener port or connection slot.
#define PROTOCORE_BEGIN_DECLS
Give a header's declarations C linkage, so their symbol names carry no parameter types.
_Bool proto_bool
The truth value.
#define PROTOCORE_END_DECLS