After spending 2 days wrangling with scopes, here’s what I have learned:
Don’t test Oauth with your main account
Your main account that you used to set up the client with, are given all scopes, regardless of what you provide in the “https://www.patreon.com/oauth2/authorize” url.
This means that parts of your application could break, as soon as you test it with a different account, even though your code is the same.
Scopes stays persistent to the account, even if you change the scopes
So if you first set the scopes as “identity identity.memberships”. Those two scopes will persist for the account even if you update the scopes to just “identity”.
This appears to be standard behaviour for Oauth, as YouTube does the same. However, it’s very confusing when you haven’t used Oauth before.
If you’re not aware of this behaviour, you may be tempted to reduce the scope to test if things break and then assuming that you don’t need those additional scopes.
You are able to revoke permissions, clearing the scopes
There is no API endpoint for this, but there is a setting for your patreon account.
You have to go to Settings > More > Connected Apps
Then look for your app and click Disconnect, followed by Revoke permissions.
The identity.memberships scope can not be used without identity
If you only use the"identity.membership" scope, when using the “https://www.patreon.com/api/oauth2/v2/identity” endpoint, you get the following error:
The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn’t understand how to supply the credentials required.
This happens to be a generic error, not specific to the Patreon API.
The confusing part is that the permissions for identity and identity.memberships overlap:
identity:
• View Patreon identity info, including full name, account status, and connected social accounts
identity.memberships:
• View Patreon identity info, including full name, account status, and connected social accounts and pledges, including status, amount, and history
This would make you assume that you only need identity.memberships.
What could Patreon do to improve the developer experience
-
Add a flag for the authorize endpoint, such as “use_developer_scope=false”. This would not break existing applications, while ensuring that you can use your main account for testing. This should also be recommended in the documentation.
-
Add a flag to the authorize endpoint, such as “override_scope=true”. This would result in more predictable behaviour.
-
Either add an endpoint for revoking permissions or make it very clear in the developer documentation that this setting exists.
-
Fix the backend issue as well as make the error list the exact scopes needed for the request you are attempting to make.