1. Home
  2. Docs
  3. General
  4. How to use your own OAuth2 server

How to use your own OAuth2 server

 

The Conversation.one platform has a built-in implementation for OAuth server needed to perform an account linking process. However, you can choose not to use Conversation.one OAuth server, and use your own instead.

If you use your own OAuth2 server instead of Conversation.one implementation, you will also have to implement a second-factor authentication using a PIN code.

Configuration

When configuring the different service; Amazon Alexa or Google Home, you should not use conversation.one URIs and settings for account linking, and instead use your own server URIs and settings.

Accessing the user’s access-token

To make API requests to your backend system on behalf of a user you will need to provide an access token. In your intents response code, You can use the ConversationRequest getAccessToken method to retrieve the user’s access token.

var accessToken = req.getAccessToken();
return fetch("https://mydomain.com/API/myhandler", {
    method: 'GET',
    headers: {
      'Authorization':'Bearer ' + accessToken,
      'Content-Type':'json'
    } 
  }).then(function(res) {
    return res.json();
  }).then(function(data){
    res.say(data.response);
  });

 

Was this article helpful to you? Yes No

How can we help?