Steem Connect : access_tokenの保存先

in #jp-dev5 years ago (edited)


Steem connect.png

こんにちは、 @shogoです。

Steemアプリケーションをつくる際、Steem Connectでのログインを実装することは必須だと思います。

基本的なことはSteem Developer Portalに書いてあるのですが、access_tokenの取り扱いについてはあまり詳しく書かれていませんでした。

Steem Connectでログインすると、このような感じでaccess_tokenやusernameが帰ってきます。


token.PNG

これをどこかに保存しておかないと、毎回ログインが必要になり、URLの見栄えもよくないです。

CookieかlocalStorageのどちらに保存するのが良いのか迷っていたのですが、色々調べてみるとlocalStorageの方が良さそうです。

localStorage.setItem('sc_token', token);

localStorage.getItem('sc_token');

localStorage.removeItem('sc_token');



Steem ConnectのDemoもとても参考になりました。


Steem関連の開発情報は少なく英語のみなので、今後は簡単なことでも記事にしていきたいと思います ;)

またSteem Keychainでのログインも試してみたいと思います。

Steem On,
@shogo

Sort:  

Dear shogo:

We are SteemBet, the next generation STEEM based gaming platform. We are honored to invite you to join our first fantastic dice game, which is just the beginning of SteemBet game series. Our dividend system has now launched. The prize pool has already accumulated 2,000 STEEM and more than 60 players have participated in staking mining token SBT. A huge reward of 40,000 STEEM is awaiting! Join us NOW with other 500 STEEM users to loot HUGE dividend reward!!

SteemBet Team

Official Website
https://steem-bet.com

Discord Server
https://discord.gg/95cBN3W

Telegram Group
https://t.me/steembet

Coin Marketplace

STEEM 0.19
TRX 0.14
JST 0.030
BTC 62932.98
ETH 3353.92
USDT 1.00
SBD 2.47