Tutorial by Examples: auth

Abbreviated from https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/: Step 1: Begin authorization Send the user to this web page, with your values filled in: https://www.dropbox.com/oauth2/authorize?client_id=<app key>&response_type=code&redirect_uri=<...
git shortlog summarizes git log and groups by author If no parameters are given, a list of all commits made per committer will be shown in chronological order. $ git shortlog Committer 1 (<number_of_commits>): Commit Message 1 Commit Message 2 ... Committer 2 (<number_of_...
Django's default authentication works on username and password fields. Email authentication backend will authenticate users based on email and password. from django.contrib.auth import get_user_model class EmailBackend(object): """ Custom Email Backend to perform authent...
If the user authorizes your application, they will be redirected to the following URL: https://[your registered redirect URI]/#access_token=[an access token] &scope=[authorized scopes] Note that the access token is in the URL fragment and not the query string. This means the value w...
Add gem to the Gemfile: gem 'devise' Then run the bundle install command. Use command $ rails generate devise:install to generate required configuration file. Set up the default URL options for the Devise mailer in each environment In development environment add this line: config.action_mailer...
First choose your auth strategy and add it to your Gemfile. You can find a list of strategies here: https://github.com/intridea/omniauth/wiki/List-of-Strategies gem 'omniauth-github', :github => 'intridea/omniauth-github' gem 'omniauth-openid', :github => 'intridea/omniauth-openid' You ca...
You can use an environment filter to change the author of commits. Just modify and export $GIT_AUTHOR_NAME in the script to change who authored the commit. Create a file filter.sh with contents like so: if [ "$GIT_AUTHOR_NAME" = "Author to Change From" ] then export GIT_A...
In case of autologin or "remember me" cookie, the same quirks as in case of subdomain cookies are applying. But this time you need to configure user component, setting identityCookie array to desired cookie config. Open you application config file and add identityCookie parameters to use...
Cryptography is something very hard and after spending a lot of time reading different examples and seeing how easy it is to introduce some form of vulnerability I found an answer originally written by @jbtule that I think is very good. Enjoy reading: "The general best practice for symmetric e...
The @Header and @Body annotations can be placed into the method signatures and Retrofit will automatically create them based on your models. public interface MyService { @POST("authentication/user") Call<AuthenticationResponse> authenticateUser(@Body AuthenticationReques...
HTTP Basic Authentication provides a straightforward mechanism for authentication. Credentials are sent in plain text, and so is insecure by default. Successful authentication proceeds as follows. The client requests a page for which access is restricted: GET /secret The server responds with st...
Identifying your user is only part of security. Once you know who they are, you need a way to control their access to data in your database. Firebase Database Rules allow you to control access for each user. For example, here's a set of security rules that allows anyone to read the path /foo/, but n...
Here's an example of a rule that gives each authenticated user a personal node at /users/$user_id where $user_id is the ID of the user obtained through Authentication. // These rules grant access to a node matching the authenticated // user's ID from the Firebase auth token { "rules"...
Step 1 GET /authorize?response_type=code&client_id=[APP_KEY]&state=[RANDOM_STRING] &redirect_uri=https%3A%2F%2Fclient%2Eexample%2Ecom%2Fcb &scope=[OPTIONAL_SCOPES] HTTP/1.1 Host: server.example.com Step 2 POST /token HTTP/1.1 Host: server.example.com Content-Type: a...
Authenticate user with Plus login onCreate GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN) .requestIdToken(getString(R.string.default_web_client_id)) .requestScopes(new Scope(Scopes.PLUS_LOGIN)) .requestEmail() .build(); mGoogleApiClient...
In order to ssh into a server your identity's public key has to be added to the list of trusted keys. Most commonly this is done per-user: ssh-copy-id -i ~/.ssh/<identity>.pub <user>@<hostname> Which can be also done manually: cat ~/.ssh/<identity>.pub | ssh <user>...
If you need to add custom headers to your volley requests, you can't do this after initialisation, as the headers are saved in a private variable. Instead, you need to override the getHeaders() method of Request.class as such: new JsonObjectRequest(REQUEST_METHOD, REQUEST_URL, REQUEST_BODY, RESP_L...
public class ReAuthenticateDialogFragment extends DialogFragment { @BindView(R.id.et_dialog_reauthenticate_email) EditText mEditTextEmail; @BindView(R.id.et_dialog_reauthenticate_password) EditText mEditTextPassword; private OnReauthenticateSuccessListener mOnReauthenticat...
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController include OmniConcern %w[facebook twitter gplus linkedin].each do |meth| define_method(meth) do create end end end Note: In the part “%w[facebook twitter gplus linkedin]”, you should list ...
class CreateAuthenticationProviders < ActiveRecord::Migration def change create_table "authentication_providers", :force => true do |t| t.string "name" t.datetime "created_at", :null => false ...

Page 1 of 6