assetto-corsa-web/accweb

Long Term/Permanent Token Creation/Specification

vexersa opened this issue · 5 comments

Hello,

Please could you let me know if it is possible to create/specify a permanent token for use with the API?

it's possible, but you can also refresh your token using the endpoint GET /api/refresh_token

Thanks!

Apologies, I am still relatively new to authenticating with API's.

Could you let me know what authentication method would need to be used to auth with the API?

Alternatively, if you could point me to a resource which would teach me what I'd need to know, I would be most grateful.

I need to add the documetation about the authentication in our swagger file (https://app.swaggerhub.com/apis-docs/assetto-corsa-web/acc-web_api_documentation) ... but basicallz you need to follow this steps:

POST /api/login with body

{"password": "yoursupersecretpassword"}

Response will be a json with some information and you need to take the token attribute and send in the header of all requests.

curl 'http://localhost:8080/api/servers' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJhZG1pbiI6dHJ1ZSwiZXhwIjoxNjQ3NTYxNDExLCJtb2QiOnRydWUsIm9yaWdfaWF0IjoxNjQ3NTYwMjExLCJyZWFkX29ubHkiOqeqwenRydWUsInVzZXJfbmFtZSI6InVzZXJuYW1lIn0.SLTuHv1yYk_bx5E0WVWFF5jpJYzbifmdzDAioQfk9AqeIPv2W5-LYZhHWF6CsdLCCGijEHtjzoehigUoy0kZ5rQascxyawqegqc2oYv1IvHf_HP9Wd-Q3EL-CqfU51Lz0gSqDwdRxi6b03YAMKz0Z_uSmD1v0ZTqVIlMdVGFllV83MIxX_RMcLSJQzFEbUMxqjZRWVF1VFy6M4l447F_29EKhGKPn1I1ASXfw5APWUsCDnjrqyeq6tGpXyazVKKKTNI5vP2GmtvjcdwBXIk9y177-hbBct2KszaqmEd-oIctDC3I4y59rXEQYLIiKJK1bz3OQbqxpGwpSxD4xfLc6W4IsZIesA6NNNecEjyWwEi1Edbq74S0jlMvhO7GlTj3AG_3iErs-jOjJPWINAbIhGWtopaDDrObYADWASDsadsafdBwrHeC5k0kHa_Pbb9D_iuAUZ6FAe2MSWD1ELakFB6YFoIp0VZ19aPaisAaco9baLf1oiIIGNaFTqf6bqSMzqtcaU2ldQ6s4ixCryskE6cuHHZX2OGqYgaiO8AVxBRGTewVJ4owUBG9iFOZUSaZKmxrIiO67U8IqEMmqutv-G6NDSlMoBSq98RFqnFAJlH_hitskqtm8digrw1Ln20xZtp-q6LZqlLiiLo0IyjaMznlJGfxEKGX7n7SS_RBQyFCFBiIpdzgrBpLRIMVfBQ' 

Awesome thanks!