This commit is contained in:
Dmitry Belyaev 2020-07-06 15:08:05 +03:00
parent 84ccfd720e
commit 11be74c2ad
2 changed files with 5 additions and 4 deletions

8
app.py
View File

@ -42,12 +42,12 @@ def test_data():
) )
client_metadata = { client_metadata = {
"client_name": "Test client", "client_name": "Test client",
"client_uri": "data:text/html;charset=utf-8,client-uri", "client_uri": "https://social.yandex.net",
"grant_types": ['authorization_code', 'refresh_token'], "grant_types": ['authorization_code', 'refresh_token'],
"redirect_uris": "data:text/html;charset=utf-8,redirect-uri", "redirect_uris": "https://social.yandex.net/broker/redirect",
"response_types": ['code', 'token'], "response_types": ['code', 'token'],
"scope": 'profile', "scope": 'profile',
"token_endpoint_auth_method": 'client_secret_basic' "token_endpoint_auth_method": 'client_secret_post'
} }
client.set_client_metadata(client_metadata) client.set_client_metadata(client_metadata)
client.client_secret = gen_salt(48) client.client_secret = gen_salt(48)
@ -63,7 +63,7 @@ if __name__ == '__main__':
# http://127.0.0.1:5000/oauth/authorize?scope=profile&response_type=code&client_id=rrC8VDll9RRbBjNLhY4T9jDO # http://127.0.0.1:5000/oauth/authorize?scope=profile&response_type=code&client_id=rrC8VDll9RRbBjNLhY4T9jDO
# > curl -u rrC8VDll9RRbBjNLhY4T9jDO:CxKyWG8Z972hkLQq7hMblH7BsP4JWtQn7qahqzW15h5ZUUJI -XPOST "http://127.0.0.1:5000/oauth/token" -F client_id=rrC8VDll9RRbBjNLhY4T9jDO -F client_secret=CxKyWG8Z972hkLQq7hMblH7BsP4JWtQn7qahqzW15h5ZUUJI -F grant_type=authorization_code -F code=wur5zaxmDfxK9Qsvvebqz1N0XKa7zewSrNYJJAYHlZGfsOJa # > curl -XPOST "http://127.0.0.1:5000/oauth/token" -F client_id=rrC8VDll9RRbBjNLhY4T9jDO -F client_secret=CxKyWG8Z972hkLQq7hMblH7BsP4JWtQn7qahqzW15h5ZUUJI -F grant_type=authorization_code -F code=wur5zaxmDfxK9Qsvvebqz1N0XKa7zewSrNYJJAYHlZGfsOJa
# < {"access_token": "LBdvuoKeiY9tHJKMoLdvrG8Zfqs4FbPOz1ze0Ahv96", "expires_in": 864000, "scope": "profile", "token_type": "Bearer"} # < {"access_token": "LBdvuoKeiY9tHJKMoLdvrG8Zfqs4FbPOz1ze0Ahv96", "expires_in": 864000, "scope": "profile", "token_type": "Bearer"}
# > curl -H "Authorization: Bearer LBdvuoKeiY9tHJKMoLdvrG8Zfqs4FbPOz1ze0Ahv96" "http://127.0.0.1:5000/api/me" # > curl -H "Authorization: Bearer LBdvuoKeiY9tHJKMoLdvrG8Zfqs4FbPOz1ze0Ahv96" "http://127.0.0.1:5000/api/me"

View File

@ -2,6 +2,7 @@ import os
app_dir = os.path.abspath(os.path.dirname(__file__)) app_dir = os.path.abspath(os.path.dirname(__file__))
os.environ['AUTHLIB_INSECURE_TRANSPORT'] = 'true'
class BaseConfig: class BaseConfig:
SECRET_KEY = os.environ.get('SECRET_KEY') or '0d6e368e-bd0c-11ea-921d-9342d47f60ca' SECRET_KEY = os.environ.get('SECRET_KEY') or '0d6e368e-bd0c-11ea-921d-9342d47f60ca'