Closed arrowstem closed 3 years ago
Hi @arrowstem :wave:
Unfortunately there's no way for us to meet the requirement of "it must work without the user who would manually log in and without a browser or another UI object" as that would require your application to handle the user's credentials and then pass them to Smartcar. However, there are a couple of common patterns that you can make use of if it's possible to loosen that requirement.
auth_url
and then they can authenticate with Smartcar at their convenience. Note: you'll probably want to make use of the state
parameter so you can correlate the authorization_code
you receive with the user that authenticated. Hopefully that's helpful! :)
Feel free to e-mail support@smartcar.com if you need further help and our lovely support team will help you out
Hi gurpreetatwal,
thank you for your answer, it makes perfect sense. I have a follow-up question: would it be possible to use the refresh token for an unlimited time? It looks like it has a 2-month expiration limit when it's issued originally. Will that validity interval reset to another 2 months once the refresh token is used before its expiration? My goal is to avoid asking the EV owners to go through the manual authentication process every 2 months.
Will that validity interval reset to another 2 months once the refresh token is used before its expiration?
Yup! Every time your application uses a refresh token, that refresh token is consumed (i.e. it cannot be re-used) and a new one is issued that expires two months from that date. A common pattern here is to setup a cron job of sorts that refreshes the tokens on a periodic basis to keep the access valid
Given this we do recommend that all of our clients implement the disconnect
endpoint and make it easily accessible so that a vehicle owner may revoke their authorization if they so choose.
Hello,
this is not an issue per se but rather a question about something I couldn't find in the docs. They describe in much detail how an app gets authenticated when the user logs in via a web page or mobile app, and then "user’s browser is redirected to a specified redirect_uri." This doesn't work for me though. I'm developing a fully autonomous back-end app that won't have a front-end and which must work without the user who would manually log in and without a browser or another UI object. I wasn't able to find docs that would describe how to proceed in such a situation. Here's where I am now: I created a client and obtained auth_url as described in the docs:
My
redirect_uri
points to an URL at my server at which my app is listening and will parse a request when received. What should I do now to ask smartcar to send that request to myredirect_uri
? I triedr = requests.get(auth_url)
but I've got<Response [400]> / Bad request
. No request was sent toredirect_uri
. Please advise.Thank you,
Greg (dev ID 8f272ab7-e2ae-428b-83cc-bdfb6c44edce)