3 Ways the Coronavirus Will Disrupt the Poker World

The coronavirus has taken the world by storm, now responsible for more than 90,000 infections and 3,000 deaths. The latest findings from the WHO put the death rate at 3.4%, outpacing previous…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to create a login withGitHub and OAuth2

OAuth2 is a protocol for social login. It is a authorization framework that makes it possible for third-party apps to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf. The OAuth2 flow, as well as a description of the different components can bee seen below.

Client — Is the application that we develop and which wants to get access to the user’s account.

Resource owner –The user that is authenticating an application to get access to the account.

Authorization Server — The server that present the interface where the user can decline or accept the request.

Resource Server — Is the API server used to access the user’s information.

After following the guide for creating a simple web application we want to add the possibly to login through GitHub. First step is to add a drop-in login user interface, this can be made by running the following command.

Meteor add accounts-ui accounts-password

Users can now create an account and login to our web application. Now we want to add the option to login to the app through authorizing with GitHub. First we type the following command.

Meteor add accounts-github

The login button will also turn blue and enable the user to sign in with GitHub. If the user chose to login with GitHub, the username (that been chosen on GitHub) will be displayed.

When the user log in to the web application we want the users email to be displayed, for that we add the following in the imports/ui/App.js file. This calls the getStuff function if a user is login and returns a variable called email created as a session. We also add the session variable in the render function in the same direction.

When the user log in with their GitHub accounts both the username and email will be now be displayed in the application.

Add a comment

Related posts:

The Future Through Robotics

At some point in our lives we have all imagined a world in the distant future. A world which is so futuristic and technologically advanced that robots did a majority of our tasks. Like how instead of…

5 Things to Eliminate from Your Mornings

Much has been written about the importance of a morning routine. Equally important to getting your day off to a great start are these 5 things you should exclude from your mornings.

Tips for Introducing Faith and Spirituality to Your Children

Parents often panic when their children start to ask questions about spiritual topics. As parents, we’re often caught off-guard and left feeling guilty that we didn’t initiate the conversation…