Authentication
Authentication on Frequency is done through OAuth 2.0 and supports 3 different authentication flows.
Authorization Code Flow
The authorization code flow is for exchanging an authorization code for an access token. It should be used to have users provide you with access to their accounts and your application is a web based app that can be redirected back to.
Once you have acquired the authorization code from above or from a client who has signed in through OAuth on your application, you can exchange it for an access token.
# We can use the code granted in the previous step like so:
curl https://www.frequencyapp.com/api/v1/oauth/token
-d client_id="APPLICATION_ID"
-d client_secret="APPLICATION_SECRET"
-d code="RETURNED_CODE"
-d grant_type="authorization_code"
-d redirect_uri="urn:ietf:wg:oauth:2.0:oob"Which should return your token:
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}You can view all of your access tokens from your account page.
Client Credentials Flow
The client credentials flow is used for machine to machine authentication. It should be used when you want to authenticate your server to do something on your own behalf.
Credentials can be requested by passing in your client ID as well as your client secret. These are both generated when you create an OAuth application and can be found on your account page.
# We can use the code granted in the previous step like so:
curl https://www.frequencyapp.com/api/v1/oauth/token
-d client_id="APPLICATION_ID"
-d client_secret="APPLICATION_SECRET"
-d grant_type="client_credentials"Which should return your token:
{
"access_token": "de6780bc506a0446309bd9362820ba8aed28aa506c71eedbe1c5c4f9dd350e54",
"token_type": "bearer",
"expires_in": 7200,
"refresh_token": "8257e65c97202ed1726cf9571600918f3bffb2544b26e00a61df9897668c33a1"
}Password Flow
The password flow is used when your application is not web based, but the owner of the application is also not the owner of the resource you want to access. In this case you can provide a username and password of the user who owns the resource.
Credentials can be requested by passing in your client ID, client secret as well as a username and password of the user who owns the resources. Your client ID and secret are both generated when you create an OAuth application and can be found on your account page.
Which should return your token:
Personal Access Tokens
Personal Access tokens are created by you and act as more temporary API keys. They should be used in scripts or applications where you will only be using resources from your own account, and do not need to go through creating an OAuth application.
You can easily create a personal access token by visiting your account page.
Last updated
Was this helpful?