Authorization
If you are the website owner and you want to enable comments, you need to authorize the comments plugin using SAFE Launcher. If you want to add a comment to a SAFE website, you also need to authorize the comments plugin.
Contents
Check for an authorization token
First, the plugin checks if an authorization token is stored in the memory of the SAFE Browser.
controller.js
A different _LOCAL_STORAGE_TOKEN_KEY
is used for each website (in order to avoid collisions).
controller.js
Example
The value of _LOCAL_STORAGE_TOKEN_KEY
for safe://blog.example
would be SAFE_TOKEN_blog.example
.
If an authorization token is found
The plugin retrieves the authorization token from the memory of the SAFE Browser. For example, this can happen if you refresh a website that you had already authorized.
If an authorization token is not found
Authorize the plugin
controller.js
this._data.appInfo
represents this object:
model.js
Example
The authorization payload for blog.example
would look like this:
After you authorize the request, the plugin receives an authorization token and stores it in the memory of the SAFE Browser.
controller.js
That way, you won't have to reauthorize the plugin if you refresh the current page or access another page from the same website, because the plugin will be able to retrieve that authorization token from the memory of the SAFE Browser.
Fetch public names
Last updated
Was this helpful?