Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add revoke access token function #75

Merged
merged 6 commits into from
Nov 10, 2019
Merged

Add revoke access token function #75

merged 6 commits into from
Nov 10, 2019

Conversation

p3root
Copy link
Contributor

@p3root p3root commented Nov 8, 2019

Implementation for revoke access token.

@p3root p3root changed the title Add revoke access token Add revoke access token function Nov 8, 2019
@JSkimming JSkimming self-requested a review November 8, 2019 17:08
@JSkimming
Copy link
Owner

@p3root have you managed to actually revoke an access token?

The endpoint https://owner-api.teslamotors.com /oauth/revoke returns 200 (OK) no matter what I throw at it, but it doesn't actually revoke the access token.

  1. I've successfully acquired a new token.
curl -X POST \
  https://owner-api.teslamotors.com/oauth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&client_id=<the_client_id>&client_secret=<the_client_secret>&email=<the_email>&password=<the_password>'
  1. Used the access token to list the vehicles.
curl -X GET \
  https://owner-api.teslamotors.com/api/1/vehicles \
  -H 'Authorization: Bearer <the_access_token>'
  1. Called revoke Revoke Access Token and got a 200 (OK) response.
curl -X POST \
  https://owner-api.teslamotors.com/oauth/revoke \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d token=<the_access_token>
  1. Then used the access token again to list the vehicles again.
curl -X GET \
  https://owner-api.teslamotors.com/api/1/vehicles \
  -H 'Authorization: Bearer <the_access_token>'

If you've managed to successfully revoke an access token using /oauth/revoke, can you provide curl examples as I have above?

@p3root
Copy link
Contributor Author

p3root commented Nov 10, 2019

You need to set the Authorization Header with the access token you want to revoke.

@JSkimming JSkimming merged commit e0e91cd into JSkimming:master Nov 10, 2019
@JSkimming
Copy link
Owner

@p3root I've just published release 0.8.0 it's available to download from NuGet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants