Skip to content

Latest commit

 

History

History
168 lines (128 loc) · 7.36 KB

README.md

File metadata and controls

168 lines (128 loc) · 7.36 KB

🚀💬 RocketChat.Apps-OAuth2

Note: This Implementation has some bugs, Refer Apps.Notion Repository Instead.


Logo

RocketChat.Apps-OAuth2

Using Notion Authorization as Example

View Demo · Report Bug · Request Feature

Contributors Forks Stargazers Issues MIT License


  Backward Compatible Approach to Authorize (OAuth2) in RocketChat.Apps incase of different 
  workflow depending upon the platform using Notion Authorization as example to document this. 
  There are limitations of current version of apps-engine and will improve it in future.
  Check About-Project Section to know the Limiation.

📜 Getting Started

Prerequisites

  • You need a Rocket.Chat Server Setup
  • Rocket.Chat.Apps CLI,
  • In case you don't have run:
    npm install -g @rocket.chat/apps-cli
  • Make sure to Enable development mode

⚙️ Installation

  • Every RocketChat Apps runs on RocketChat Server, thus everytime you wanna test you need to deploy the app with this note. lets start setting up:
  1. Clone the repo
    git clone https://github.com/<yourusername>/RocketChat.Apps-OAuth2
  2. Install NPM packages
    cd oauth2; npm install
  3. Deploy app using:
    rc-apps deploy --url http://localhost:3000 --username <username> --password <password>
  1. Once its deploy, Go to Installed Apps and Settings tab in RC,you would see three input fields:
    
     # notion-client-id
     # notion-client-secret
     // Generate above Credentials from Notion By Creating the *Public* Integration.
     // Attached link above for the same.
    
     # redirecturi: if you are running server on local then input: http://localhost:3000 
     # else provide your server url without path.
     
    
  2. Once Its done save the changes, and now under the Notion Integration Provide the Webhook GET endpoint in Redirect URI field of Notion, GET Webhook Endpoint: you can find on the Current App Info under Detail tab in RC.

✅ About The Project:

  • Following things aren't possible with current apps-engine framework version (1.37.0 when writing this).

Why we need backward compatible approach?

Here's why:

  • Incase of any platform Authorization workflow can alter than the usual. In Case of Notion, it suggests to use Basic HTTP Authentication when requesting for access_token while providing the code check here
  • Now incase of usual workflow we provide the clientId and clientSecret in params but Notion and in future we may encounter any other platform which would suggest different ways to provide credentials in Authorization header. In case of Notion they suggested to provide the credentials in form of Basic CLIENTID:CLIENTSECRET where the credentials provide should be a base64.
  • In case of any platform we may need the extra info in persistance storage. In case of Notion we needed a lot of extra fields which includes workspace info, access_level of pages, userInfo including the access_token_info etc. check here

🚀 Usage :


    Use /notion to Authorize through 🚀💬 following arguments available: 
     • To login your Notion account /notion login.
     • To logout your Notion account /notion logout.
     • To check your status of Authorization with Notion /notion test.
     • To get help of Usage use /notion help.

✨ Glimpse :

oAuth.webm

🧑‍💻 Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📚 Resources

Here are some links to examples and documentation: