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 on your integration’s allow-list. To add one, email support@plugchoice.com.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.