Module: OmniContacts::Authorization::OAuth2
- Includes:
- HTTPUtils
- Included in:
- Middleware::OAuth2
- Defined in:
- lib/omnicontacts/authorization/oauth2.rb
Constant Summary
Constants included from HTTPUtils
Instance Method Summary collapse
-
#authorization_url ⇒ Object
Calculates the URL the user has to be redirected to in order to authorize the application to access his contacts list.
-
#fetch_access_token(code) ⇒ Object
Fetches the access token from the authorization server using the given authorization code.
-
#refresh_access_token(refresh_token) ⇒ Object
Refreshes the access token using the provided refresh_token.
Methods included from HTTPUtils
encode, host_url_from_rack_env, query_string_to_map, scheme, to_query_string
Instance Method Details
#authorization_url ⇒ Object
Calculates the URL the user has to be redirected to in order to authorize the application to access his contacts list.
22 23 24 |
# File 'lib/omnicontacts/authorization/oauth2.rb', line 22 def "https://" + auth_host + + "?" + end |
#fetch_access_token(code) ⇒ Object
Fetches the access token from the authorization server using the given authorization code.
42 43 44 |
# File 'lib/omnicontacts/authorization/oauth2.rb', line 42 def fetch_access_token code access_token_from_response https_post(auth_host, auth_token_path, token_req_params(code)) end |
#refresh_access_token(refresh_token) ⇒ Object
Refreshes the access token using the provided refresh_token.
70 71 72 |
# File 'lib/omnicontacts/authorization/oauth2.rb', line 70 def refresh_access_token refresh_token access_token_from_response https_post(auth_host, auth_token_path, refresh_token_req_params(refresh_token)) end |