GithubHelp home page GithubHelp logo

isabella232 / ruby-connect-rest-sample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoftgraph/ruby-connect-rest-sample

0.0 0.0 0.0 346 KB

[ARCHIVED] Use Microsoft Graph to access a user’s Microsoft account resources from within a Ruby on Rails web application. This sample uses REST calls directly to Microsoft Graph, and uses the Azure AD v2.0 endpoint for authentication of users' work or school Office 365 accounts.

License: MIT License

Ruby 73.13% HTML 24.86% CSS 2.01%

ruby-connect-rest-sample's Introduction

[ARCHIVED] Microsoft Graph Ruby on Rails Connect Sample

IMPORTANT

This project is being archived and replaced with the Build Ruby on Rails apps with Microsoft Graph. As part of the archival process, we're closing all open issues and pull requests.

You can continue to use this sample "as-is", but it won't be maintained moving forward. We apologize for any inconvenience.

Use Microsoft Graph to access a user’s Microsoft account resources from within a Ruby on Rails web application. This sample uses REST calls directly to the Microsoft Graph endpoint to work with user resources--in this case, to send an email as the user.

The sample uses OmniAuth middleware to authenticate against the Azure AD v2.0 endpoint. The Azure AD v2.0 endpoint enables developers to write a single code flow that handles authentication for both users' work or school (Azure Active Directory) or personal (Microsoft) accounts, including Office 365, Outlook.com, and OneDrive accounts.

The sample also uses the Office Fabric UI for styling and formatting the user experience.

Microsoft Ruby on Rails Connect sample screenshot

Prerequisites

To use this sample, the following are required:

Register the application

Register an app on the Microsoft App Registration Portal. This generates the app ID and password that you'll use to configure the app for authentication.

  1. Sign into the Microsoft App Registration Portal using either your personal or work or school account.

  2. Choose Add an app.

  3. Enter a name for the app, and choose Create.

    The registration page displays, listing the properties of your app.

  4. Copy the Application Id. This is the unique identifier for your app.

  5. Under Application Secrets, choose Generate New Password. Copy the app secret from the New password generated dialog.

    You'll use the application ID and app secret to configure the app.

  6. Under Platforms, choose Add platform > Web.

  7. Make sure the Allow Implicit Flow check box is selected, and enter http://localhost:3000/auth/microsoft_v2_auth/callback as the Redirect URI.

    The Allow Implicit Flow option enables the OpenID Connect hybrid flow. During authentication, this enables the app to receive both sign-in info (the id_token) and artifacts (in this case, an authorization code) that the app uses to obtain an access token.

    The redirect URI http://localhost:3000/auth/microsoft_v2_auth/callback is the value that the OmniAuth middleware is configured to use once it has processed the authentication request.

  8. Choose Save.

Build and run the sample

  1. Download or clone the sample and open it in the editor of your choice.

  2. If you don't already have bundler, you can install it with the following command.

    gem install bundler
    
  3. In the config/environment.rb file do the following.

    1. Replace ENTER_YOUR_CLIENT_ID with the app ID of your registered application.
    2. Replace ENTER_YOUR_SECRET with the app secret for your registered application.
  4. Install the Rails application and dependencies with the following command.

    bundle install
    
  5. To start the Rails application, type the following command.

    rails server --port=3000
    
  6. Go to http://localhost:3000 in your web browser.

Contributing

If you'd like to contribute to this sample, see CONTRIBUTING.MD.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Questions and comments

We'd love to get your feedback about the Microsoft Graph Ruby on Rails Connect sample. You can send your questions and suggestions to us in the Issues section of this repository.

Your feedback is important to us. Connect with us on Stack Overflow. Tag your questions with [MicrosoftGraph].

See also

Copyright

Copyright (c) 2016 Microsoft. All rights reserved.

ruby-connect-rest-sample's People

Contributors

andrewjmay avatar davegregg avatar davidchesnut avatar iambmelt avatar jasonjoh avatar o365devx avatar officegsx avatar ricalo avatar tadaomachida avatar v-pazal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.