Experiment osm oauth2 - #331
Conversation
But Oauth2 requires librest >=0.9 This version is only available in Ubuntu 22.04
|
Doesn't quite compile for me: Presumably should be g_object_unref() Please resolve all compiler warnings. Mostly 'gchar*' in _OsmApiClientClass and function definitions versus 'const gchar*' as returned by librest functions. Please ensure consistent indentation/mixed use of spaces and tabs in osm_api_client.c. Preferably just use spaces. At some point will want to ensure optional compilation against librest (and thus disable OSM auth capability when not available) as it is not critical to general Viking operation. For osm-oauth2-example.c - please move out of main src directory and put elsewhere - e.g. into tools/ or doc/dev/examples. For osm-oauth2-example.c - change the Copyright statement appropriately. For osm-oauth2-example.c - change the comment about 'flow for Gitlab' to something more appropriate. Presumably the commented keys in the osm-oauth2-example.c are registered to you? For osm-oauth2-example.c the 'returns' when an environment variable isn't set should be EXIT_FAILURE not EXIT_SUCCESS as clearly the program has failed to do anything useful. For osm-oauth2-example.c is better if some of the g_print() includes 'FUNCTION' in the output to distinguish between otherwise identical strings to help understand what is being called (and in what order). In using osm-oauth2-example.c - it's unclear what getline() is for - i.e. explicitly tell the user to enter (or click on if terminal enabled) the Authorize URL generated above into a Webbrowser and confirm authorization access there - which then should respond with an Authorization code - which then should be input back into the CLI program.
So looks like the librest (pkce) / libsoup methods have potential. How are we to proceed? (do you want me to build on your prototype? I probably won't have much time until end of September) |
|
Thanks a lot for the review. I forgot to mention it is only a REALLY preliminary work, just to understand how to work with Oauth2. And I wanted to inform the Viking's community that this topic is under work in progress. But I have really few spare time currently. Note: I don't plan to keep this Git branch. It is really for experimentation and sharing the work in progress. After these iterations, I identified the following ideas. The main process is:
For the user, I'm now able to imagine the following process:
Perhaps it would be better to use a "wizard" approach for this dialog:
But I also have an other topic to investigate. As you can see, the example use librest and libsoup. Initially I understood this is mandatory due to a complex implementation hidden in librest/libsoup. But I found some examples to register with curl directly. So, I will try to recode without librest/libsoup. Stay tuned! |
Fixes #196