Skip to content

PIMPfiction/google-oauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Google Oauth2 Callback Server

This server can be used as callback url in Google APIs. You can authorize google users through your API with these server. Server will redirect user to google authentication/login page. User will be prompted to confirm your app. After confirmation; Server will generate Bearer token which can be used in google apis. Callback server will generate acccess token and refresh token.

API Reference

Main Route - Redirect Users to Google Authentication Page

  GET /

Check and Refresh Token - Checks validity of access token, if it is expired it will be refreshed

  GET /check_token/?token=${token}&refresh_token=${refresh_token}
Parameter Type Description
token string Required. Your Access Token (from downlaoded csv file)
refresh_token string Required.Your Refresh Token (from downlaoded csv file)

Directly Run from Source

Deploy on Heroku (so it will be accessible by all users)

  • Create account on heroku (https://www.heroku.com/)

  • Install heroku CLI - (https://devcenter.heroku.com/articles/heroku-cli#install-the-heroku-cli)

  • Run below code to login to heroku ⬇

        heroku login
  • Then execute below commands in order to deploy code to heroku

        git init
        git add . 
        git commit -m "First commit of google-oauth-server"

    Below command will give you your apps link (it is important) ⚠ Copy that link to your json file, and replace "redirect_uri"

        heroku create -a your-app-name
        heroku config:set HEROKU_ENV=vats --app your-app-name
  • Edit config.json file. You will edit values in "heroku" key. Replace 'redirect_uri' with heroku app's link.

        For example your heroku url is https://awesome-server-2299.herokuapp.com/
        So your redirect_uri must be "https://awesome-server-2299.herokuapp.com/auth_handler"
    
  • Now we are executing final command, this will deploy our app on heroku.

        git push heroku main

About

This server can be used for callback url in Google API. Server will generate Bearer Token. You can use this bearer token in when making request to Google's APIs.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages