web_url.
Open Link
1
Create a client session
Your server creates a client session for your user, as in Get started, scoped to what the user is about to do. Add a
redirect_uri to send the user back when they’re done.2
Send the browser to web_url
The answer’s
web_url already holds the client secret. For an action other than add, append the action and its charger. For add at one of the scope’s sites, append site_id.3
Confirm the outcome
When the user comes back, your server confirms the link session with Get a link session.
server.ts
#:
The client secret in the URL
Browsers never send a URL’s fragment to a server, so the secret doesn’t reach server logs or aReferer header. The hosted flow reads it and removes it from the address bar at once. If the user reloads the page, the link session carries on.
In a browser, Link can’t ask your app for a new secret, as the mobile SDK does. Open web_url within 60 minutes of creating the client session, or the user sees an error. Create a new client session for every visit rather than storing the URL. Once open, a link session lasts up to 6 hours.
When the user is done
With aredirect_uri, the hosted flow sends the browser there, with two query parameters added:
redirect_uri, the hosted flow tells the user they can close the page.
A
redirect_uri must be one of your integration’s Return URLs. A team admin adds them under Settings > SDK in Plugchoice, in the integration’s settings, one per line.Without an app or a server
A start link opens Link with no code of yours: hand it out in installation papers, an email or on your website. It looks likehttps://connect.plugchoice.com/start/7K2Q-9MXD, with a QR code to download.
- A team admin makes it under Settings > SDK in Plugchoice, in the integration. Only an integration whose chargers stay in your users’ own Plugchoice accounts can have one. Plugchoice support can make one for you too.
- New link replaces the link at once: the old one and its QR code stop working. Turn off stops it. Anyone who already started can finish.
- Anyone who opens it sets up a charger in their browser, signs in to their own Plugchoice account or creates one, and agrees on your consent screen. The charger stays in their account, and you get a grant on it, as with a client session.
- Each person starts as a new customer of yours, with an
external_user_idofstart:and a UUID. When they sign in to an account you already have a customer for, they join that customer. - When your team is a Plugchoice reseller, new chargers get your team as their reseller.
- A link that no longer works shows its own page (
start-code-invalid).
POST /sdk/v1/start/{code} to open the link. You don’t call it.
What works in a browser
A browser can’t join a charger’s Wi-Fi or reach chargers on the local network, so some setups need the mobile SDK. In a browser, the hosted flow only offers what it can do there.
Bluetooth in a browser works in Chrome and Edge on Android, Windows, macOS and ChromeOS. It doesn’t work in Safari, so not in any browser on an iPhone, nor in Firefox. There, the hosted flow skips the Wi-Fi step and waits for the charger to come online another way, such as a network cable or a SIM.
In Chrome or Edge, the browser asks which device to use: the user taps Connect, then picks the charger, which is named after its Chargepoint ID (a SolarEdge after its serial number, such as
S61234345678, which ends in the Chargepoint ID’s last 6 digits).