Skip to content
Nam Nguyen Van edited this page Mar 1, 2017 · 2 revisions

CREATE A NEW TEST APPLICATION

Now, navigate to http://localhost:3000/oauth/applications and click “New Application”.

oauth client application registration

FILL OUT THE APPLICATION FORM FIELDS

Fill out the name field with whatever you like. The redirect URI field should be filled out with “http://localhost:3001/oauth/callback”. You can leave the scopes blank for this demonstration.

new oauth client application form params

CHANGE THE CLIENT SECRET AND ID IN THE LOCAL COPY OF OUR OAUTH CLIENT

I have a test OAuth client at this GitHub repository that you can clone and use out of the box.

Now, in config/local_env_for_oauth.yml, change the OAUTH_TOKEN and OAUTH_SECRET values with the Application Id and Secret values for the application you just registered. You can see my values in the screenshot below.

oauth client application creation success page

STEP 9 (OPTIONAL) – GET IT WORKING ON YOUR MACHINE

CREATE A USER IN THE LOCAL OAUTH PROVIDER REPOSITORY YOU DOWNLOADED

The way I have the OAuth provider setup is that you must sign in as an authorized user so you can see the test setup working. You can create a dummy user by running the seeds file with rake db:seed .

Next, navigate to http://localhost:3000/users/sign_in and sign in with "[email protected]" with the password of "12345679".

Now if you navigate to http://localhost:3001 in your browser, you’ll see your OAuth provider asking you to give your OAuth client permission to access the protected resource.

 oauth client application authorization

If you click “Authorize”, you should see something like the below in your browser:

oauth_provider_client_success

Guide full test provider