Mercurial > minori
comparison src/services/kitsu.cc @ 335:5098387a3a46
kitsu: remove unused constants, fix token expiration calculation
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 19 Jun 2024 06:11:38 -0400 |
parents | 948955c3ba81 |
children | 7e97c566cce4 |
comparison
equal
deleted
inserted
replaced
334:948955c3ba81 | 335:5098387a3a46 |
---|---|
26 | 26 |
27 #include <iostream> | 27 #include <iostream> |
28 | 28 |
29 using namespace nlohmann::literals::json_literals; | 29 using namespace nlohmann::literals::json_literals; |
30 | 30 |
31 static constexpr std::string_view CLIENT_ID = "dd031b32d2f56c990b1425efe6c42ad847e7fe3ab46bf1299f05ecd856bdb7dd"; | |
32 static constexpr std::string_view CLIENT_SECRET = "54d7307928f63414defd96399fc31ba847961ceaecef3a5fd93144e960c0e151"; | |
33 | |
34 static constexpr std::string_view BASE_API_PATH = "https://kitsu.io/api/edge"; | 31 static constexpr std::string_view BASE_API_PATH = "https://kitsu.io/api/edge"; |
35 static constexpr std::string_view OAUTH_PATH = "https://kitsu.io/api/oauth/token"; | 32 static constexpr std::string_view OAUTH_PATH = "https://kitsu.io/api/oauth/token"; |
36 | 33 |
37 namespace Services { | 34 namespace Services { |
38 namespace Kitsu { | 35 namespace Kitsu { |
78 } | 75 } |
79 } | 76 } |
80 | 77 |
81 session.config.auth.kitsu.access_token = result["/access_token"_json_pointer].get<std::string>(); | 78 session.config.auth.kitsu.access_token = result["/access_token"_json_pointer].get<std::string>(); |
82 session.config.auth.kitsu.access_token_expiration | 79 session.config.auth.kitsu.access_token_expiration |
83 = result["/created_at"_json_pointer].get<Time::Timestamp>(); | 80 = result["/created_at"_json_pointer].get<Time::Timestamp>() |
84 + result["/expires_in"_json_pointer].get<Time::Timestamp>(); | 81 + result["/expires_in"_json_pointer].get<Time::Timestamp>(); |
85 session.config.auth.kitsu.refresh_token = result["/refresh_token"_json_pointer].get<std::string>(); | 82 session.config.auth.kitsu.refresh_token = result["/refresh_token"_json_pointer].get<std::string>(); |
86 | 83 |
87 /* the next two are not that important */ | 84 /* the next two are not that important */ |
88 | 85 |