顯示具有 OAuth 標籤的文章。 顯示所有文章
顯示具有 OAuth 標籤的文章。 顯示所有文章

2014年8月30日 星期六

使用 GitHub OpenID 登入網站

1. 建立一個新的 application,可得到 Client ID、Client Secret
https://github.com/settings/applications

2. 在 Authorization callback URL 填入授權成功後要返回的網址


github = OAuth2Service(name='github',
                         authorize_url='https://github.com/login/oauth/authorize',
                         access_token_url='https://github.com/login/oauth/access_token',
                         client_id=CLIENT_ID,
                         client_secret=CLIENT_SECRET,
                         base_url='https://api.github.com/',
                         )

使用 Facebook OpenID 登入網站

1. 建立一個 Facebook APP, 可得到 Client ID、Client Secret
https://developers.facebook.com/apps/

2. Settings -> Advanced -> Valid OAuth redirect URIs 填入授權成功後的返回網址


facebook = OAuth2Service(name='facebook',
                         authorize_url='https://graph.facebook.com/oauth/authorize',
                         access_token_url='https://graph.facebook.com/oauth/access_token',
                         client_id=config.get('FACEBOOK', 'client_id'),
                         client_secret=config.get('FACEBOOK', 'client_secret'),
                         base_url='https://graph.facebook.com/',
                         )

https://github.com/a0726h77/opensourcefeeds.tw/blob/master/wsgi/app/controllers/facebook.py

2014年8月29日 星期五

使用 Google OpenID 登入網站

Google Developers Console
https://console.developers.google.com/


google = OAuth2Service(name='google',
                         authorize_url='https://accounts.google.com/o/oauth2/auth',
                         access_token_url='https://accounts.google.com/o/oauth2/token',
                         client_id=CLIENT_ID,
                         client_secret=CLIENT_SECRET,
                         base_url='https://www.googleapis.com/oauth2/v1/',
                         )

https://github.com/a0726h77/opensourcefeeds.tw/blob/master/wsgi/app/controllers/google.py




References :
Using OAuth 2.0 for Login (OpenID Connect) - Google Accounts Authentication and Authorization — Google Developers
not engage in honest work: 使用Google帳號登入自己的網站