Authentication
You'll need to authenticate your requests to access any of the endpoints in the SELF API. In this guide, we'll look at how authentication works. SELF offers two ways to authenticate your API requests: Basic authentication and OAuth2 with a token — OAuth2 is the recommended way.
No authentication
During this MVP stage of the SELF project, we have opened our API portal for general development purposes since a lot of new functionality may be at a rudimentary stage. If you have any feedback, please let us know!
Basic authentication
With basic authentication, a username and password is required to authenticate HTTP requests. This option is strictly limited for the SELF development team and not used for 3rd party integrators.
Example request with basic auth
curl https://self-api.com/api/v1/auth
-u username:password
Please don't comprimize your SELF API token!
OAuth2 with API token
The OAuth 2.0 authorization framework is a protocol that allows a user to grant a third-party web site or application access to the user's protected resources, without necessarily revealing their long-term credentials or even their identity.
The recommended way to authenticate with the SELF API is by using OAuth2. When establishing a connection using OAuth2, you will need your access token — you will find it in the SELF dashboard under API settings. Here's how to add the token to the request header using cURL:
Example request with SELF API token
name predator
// --> resolves walletAddress ... thats all!
Always keep your token safe and reset it if you suspect it has been compromised.
Using an SDK
If you use one of our official widgets or use the boilerplate, you won't have to worry about any of the above — fetch your access token from the SELF dashboard under API settings, and our client library will take care of the rest.