-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Now, navigate to http://localhost:3000/oauth/applications and click “New Application”.
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.
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.
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.
If you click “Authorize”, you should see something like the below in your browser: