> ## Documentation Index
> Fetch the complete documentation index at: https://docs.axle.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Smart charging app

Axle provides a complete hosted smart-charging app that can be added to your existing application as its own page.
With this solution, Axle manages the entire smart-charging flow end-to-end.

<Frame>
  <img src="https://mintcdn.com/fascinating-teal-alpaca/A8R6SAfID51DsTBv/images/smart-charge-app.png?fit=max&auto=format&n=A8R6SAfID51DsTBv&q=85&s=8919d36d17123b4c72091bc747163808" className="h-[44rem]" width="393" height="852" data-path="images/smart-charge-app.png" />
</Frame>

## Embedding the app

You can either link directly out to `https://smart-charging-sandbox.axle.energy`, or embed the page within a Native app
using a WebView.

Axle will manage onboarding users and controlling their charging.
To connect to a users charger and car, Axle can integrate with your APIs, or Axle also works with Enode to gain
programmatic access to assets.

<Info>To see what including Enode in your onboarding flow might look like, see [Integrating with native Enode Link SDK](/components/guides/enode-integration)</Info>

## Theming

The app can be styled to match your brand. See the [theming guide](/components/guides/theming) for the full set of design tokens available.

## Authentication

### IFrame

To securely pass tokens into the smart charging application when hosting in an IFrame, use the `postMessage` API.

```
iframe.window.postMessage(
  {
    type: "axle:token",
    token: "<YOUR COMPONENT_TOKEN>",
  },
  "https://smart-charging-sandbox.axle.energy"
);
```

### Webview

If hosting the Smart charging application within a native application, you can pass in the token as a header in the initial request to `https://smart-charging-sandbox.axle.energy/auth/token`.
This page will securely establish a session, then redirect the customer to the appropriate page (a dashboard or proposition screen)
The Axle hosted app will manage further authentication to Axle APIs.

<Info>This example is for iOS, but the approach is similar on Android. If you want integration advice, [get in touch](mailto:support@axle.energy) and we'll happily provide technical guidance</Info>

```swift theme={null}
final class ViewController: UIViewController {

  private let config = WKWebViewConfiguration()
  private lazy var webView: WKWebView = {
    return WKWebView(frame: .zero, configuration: config)
  }()

  override func viewDidLoad() {
      super.viewDidLoad()
      view = webView
      let url = URL(string: "https://smart-charging-sandbox.axle.energy/auth/token")!
      var req = URLRequest(url: url)
      req.setValue(token, forHTTPHeaderField: "token")
      webView.load(req)  // Header goes out on this initial request only
  }

  private let token = "your-one-time-token"
}

```
