Authentication
POST ResetToken
https://api.track.toggl.com/api/v9/me/reset_token
Resets API token for the current user.
- cURL
- Go
- Ruby
- JavaScript
- Python
- Rust
curl -X POST https://api.track.toggl.com/api/v9/me/reset_token \
-H "Content-Type: application/json" \
-u <email>:<password>
req, err := http.NewRequest(http.MethodPost,
"https://api.track.toggl.com/api/v9/me/reset_token")
if err != nil {
print(err)
}
req.Header.Set("Content-Type", "application/json; charset=utf-8")
req.SetBasicAuth("<email>", "<password>")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
print(err)
}
defer resp.Body.Close()
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
print(err)
}
fmt.Print(string(body))
require 'net/http'
require 'uri'
require 'json'
uri = URI('https://api.track.toggl.com/api/v9/me/reset_token')
http = Net::HTTP.new(uri.host, uri.port)
req = Net::HTTP::Post.new(uri.path)
req['Content-Type'] = "application/json"
request.basic_auth '<email>', '<password>'
res = http.request(req)
puts JSON.parse(res.body)
fetch("https://api.track.toggl.com/api/v9/me/reset_token", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Basic ${base64.encode(<email>:<password>)}`
},
})
.then((resp) => resp.json())
.then((json) => {
console.log(json);
})
.catch(err => console.error(err));
import requests
from base64 import b64encode
data = requests.post('https://api.track.toggl.com/api/v9/me/reset_token', headers={'content-type': 'application/json', 'Authorization' : 'Basic %s' % b64encode(b"<email>:<password>").decode("ascii")})
print(data.json())
extern crate tokio;
extern crate serde_json;
use reqwest::{Client};
use reqwest::header::{CONTENT_TYPE};
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = Client::new().basic_auth("<email>", "<password>");
let json = client.request(Method::POST, "https://api.track.toggl.com/api/v9/me/reset_token".to_string())
.header(CONTENT_TYPE, "application/json")
.send()
.await?
.json()
.await?;
println!("{:#?}", json);
Ok(())
}
Response
200
Successful operation.
403
User does not have access to this resource.
500
Internal Server Error