For those, who is struggling with the same – I’ve managed to find out the workflow.
-
The initial request should be /oauth2/authorize?response_type=code&client_id=<my_app_client_id>&redirect_uri=<my_redirect_uri>&state=<my_identifier>&scope=identity%20identity%5Bemail%5D (please pay attention to the value of the scope parameter)
-
After user authorises our app in the web view, Patreon redirects to the <my_redirect_uri> with the code parameter. get the value and use it to get the access and refresh tokens via
/api/oauth2/token endpoint. -
To get the email of the patron, you should add a header “Authorization”: “Bearer <access_token>” (i.e. “Authorization”: “Bearer 123xyz456abc789”) and perform the request
/api/oauth2/v2/identity?fields%5Buser%5D=email&include=memberships&fields%5Bmember%5D=patron_status -
From the response to that request, you’d be able to find out if the logged in user is actually your patron, what is her or his email, and is the patron actually an active patron, or just a former one.
Problem solved!
cc @Urban_Griller
Thanks again @codebard for your help!