Book Image

DART Cookbook

By : Ivo Balbaert
Book Image

DART Cookbook

By: Ivo Balbaert

Overview of this book

Table of Contents (18 chapters)
Dart Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Authorizing OAuth2 to Google services


You certainly have already seen websites where you can log in using your Google, Facebook, or Twitter account, instead of having to enter your information all over again. This service is most probably powered by OAuth2, which means (the second version of) the open (web) standard for authorization. It provides secured access to the server side of your application for clients that have been given an access token by a third-party OAuth2 authorization server. The credentials are guaranteed to be verified by the token and are not given to you as the website owner. The Dart team and community have provided us with some nice packages to easily implement this functionality.

How to do it...

If you want to use OAuth2 authentication from Google in a client app, there is the google_oauth2_client library. Add google_oauth2_client to your pubspec.yaml dependencies and let pub in Dart Editor install it, or invoke pub get in the command line. Add the following to your...