Skip to content
This repository was archived by the owner on Apr 23, 2019. It is now read-only.

browser support #25

Merged
merged 21 commits into from
Jun 17, 2016
Merged

browser support #25

merged 21 commits into from
Jun 17, 2016

Conversation

nukosuke
Copy link
Owner

@nukosuke nukosuke commented Jun 16, 2016

Node.jsとブラウザにおけるAuthorizationServiceの差

Node.jsとブラウザのそれぞれのAuthorizationServiceメソッドサポート

authorize() token() info() revoke()
Node.js 🙅 🙆‍♀️ 🙆‍♀️ 🙆‍♀️
ブラウザ 🙆‍♀️ 🙅 🙆‍♀️ 🙆‍♀️
  • authorize()はリダイレクトを伴うためブラウザのみサポート。
  • 逆に、ブラウザやクライアントアプリでclient_secretは得られない(得られる設計は間違っている)ためtoken()はサーバを前提としてNodeのみサポート。

@nukosuke nukosuke added this to the v0.0.4 milestone Jun 16, 2016
@nukosuke nukosuke self-assigned this Jun 16, 2016
@@ -0,0 +1 @@
module.exports = require('./annict').default;
Copy link
Owner Author

@nukosuke nukosuke Jun 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ブラウザにおいてのみ.defaultなしで

var annict = new Annict();

するための措置。close #22

@nukosuke
Copy link
Owner Author

nukosuke commented Jun 16, 2016

つらいことになってる。Annict側にお願いするしかない。

2016-06-17 00 46 25

@nukosuke
Copy link
Owner Author

nukosuke commented Jun 16, 2016

当該ソースとHTML。

<body>
    <script type='text/javascript'>
        var access_token = 'hogehoge';
    </script>

    ...

    <script type='text/javascript' src='/js/annict.min.js'></script>
    <script type='text/javascript'>
        var annict = new Annict();
        annict.client.setHeader('Authorization', 'Bearer ' + access_token);
        annict.OAuth.info().then(function(res) {
            console.log(res);
        });
    </script>
</body>

@nukosuke nukosuke merged commit 9d66629 into develop Jun 17, 2016
@nukosuke nukosuke deleted the feature/browser branch June 17, 2016 15:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant