You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For the account authentication, here is some information for reference.
What's the difference between the CSRF token and the OAuth access token when calling Wikidata API?
1. OAuth Access Token
The OAuth access token is a long-term token that grants your application permission to act on behalf of a user or account (like UMIL’s public account).
Once you have an OAuth access token, you no longer need the user’s username and password, nor do you need to manually retrieve a CSRF token.
OAuth tokens handle authentication and permissions. With an OAuth token, your API requests are inherently authorized without needing extra authentication steps.
2. CSRF Token
The CSRF token is a short-term, single-use token that’s primarily used to prevent unauthorized actions by malicious scripts or cross-site requests.
If you’re using a username and password directly (rather than OAuth), you must fetch a CSRF token each time you make an editing request to authenticate the specific action.
Key Difference
When using OAuth: The OAuth access token replaces both the username/password and the CSRF token, meaning you don’t need to retrieve a CSRF token for each request. The OAuth token itself serves as the authorization mechanism for any edits or data publishing.
When not using OAuth: If you’re relying on direct login with a username and password, the API requires a CSRF token for each action to confirm that it’s an authorized request.
Simplified Process with OAuth
With an OAuth access token:
Obtain the OAuth access token once (or refresh it as needed).
For each API request, include the OAuth access token in the Authorization header.
Here's what an API call looks like with OAuth (without needing a CSRF token):
The text was updated successfully, but these errors were encountered: