The state of your app running in Nodejs can be displayed to users as a web page in obnizCloud.
Users can view your app without having to go through any screen transitions or perform any extra authentication.
In the app settings, if you enter the URL in the "Application URL" section
- Press "Open App" on the installed device.
- Press "Open the app" from the list of apps being used.
Occasionally the web site will be displayed in the page with the application URL configured in the iFrame.
Then two parameters will be added to the query string
- token: This user's OAuthToken for your app
- obniz_id: obnizID when you press Open App from device
This allows your server to determine "whose and what device" the request is for and to render the web page.
Example
// Runkit Example
const express = require('express')
const app = express()
const getSdk = require('obniz-cloud-sdk').getSdk
app.post('/app', async (req, res) => {
const sdk = getSdk(req.query.token); // use oauth token
const result = await sdk.user();
const user = result.user;
res.send(`user = ${user.name} obniz = ${req.query.obniz_id}`);
})
app.listen(3000)