Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app = Flask(__name__)
Bootstrap(app)
"""
This simple Flask app shows how to use the Smartcar Python SDK to
let users authorize our application to interact with their car(s),
including reading information and location, and unlocking and locking their vehicle.
It begins by importing smartcar, and initializing a client with the SDK. It must provide
the client_id and client_secret obtained from registering the application on developer.smartcar.com.
In addition, it specifies the callback url in your app to redirect to after the user authenticates
with Smartcar, and enumerates the permissions you will ask the user to authorize.
"""
client = smartcar.Client(
client_id='INSERT YOUR CLIENT ID HERE',
client_secret='INSERT YOUR CLIENT SECRET HERE',
redirect_uri='http://localhost:4000/callback',
scope=['read_vehicle_info', 'read_vin', 'read_security', 'control_security', 'read_location']
)
# dummy database that will hold the user's tokens needed to interact with smartcar.
db = {}
db['vehicles_to_service'] = []
@app.route('/')
def homepage():
"""
This function uses the smartcar client to get the authentication url for the 'Mock' OEM
with client.get_auth_url. It renders a page with a button that routes the user to this auth url,
where they will be prompted to authorize the application to access the permissions enumerated