/torii-vk

Primary LanguageJavaScriptMIT LicenseMIT

Torii VK

Provider for authentication on vk.com using Torii.

Installation

npm i torii-vk --save-dev

Using

To use this addon you must create app. And add clientId in environment file.

...
  ENV['torii'] = {
    providers: {
      'vk-oauth2': {
        clientId: <clientId>
      },
      'vk-oauth2-bearer': {
        clientId: <clientId>
      }
    }
  }
...

Add the action in the route:

...
  actions: {
    authenticate(provider) {
      this.get('torii').open(provider).then(authData => {
        //Your code
      }, error => {
        //Your code
      });
    }
  }
...

In template:

...
  <button {{action 'authenticate' 'vk-oauth2-bearer'}}>
    Implicit Flow
  </button>
  <button {{action 'authenticate' 'vk-oauth2'}}>
    Authorization code flow
  </button>
...

Support

Having trouble? Open an issue!