This repository was archived by the owner on Jun 23, 2023. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,6 +49,41 @@ The identity representation with the information fetched from the user info endp
4949We can even test the single logout
5050
5151
52+ Refresh token
53+ -------------
54+
55+ Here an example about how to refresh a token.
56+ It is important to consider that only scope=offline_access will get a usable refresh token.
57+
58+
59+ import requests
60+
61+ CLIENT_ID = "DBP60x3KUQfCYWZlqFaS_Q"
62+ CLIENT_SECRET="8526270403788522b2444e87ea90c53bcafb984119cec92eeccc12f1"
63+ REFRESH_TOKEN = "Z0FBQUFBQ ... lN2JNODYtZThjMnFsZUNDcg=="
64+
65+ data = {
66+ "grant_type" : "refresh_token",
67+ "client_id" : f"{CLIENT_ID}",
68+ "client_secret" : f"{CLIENT_SECRET}",
69+ "refresh_token" : f"{REFRESH_TOKEN}"
70+ }
71+ headers = {'Content-Type': "application/x-www-form-urlencoded" }
72+ response = requests.post(
73+ 'https://127.0.0.1:8000/oidcop/token', verify=False, data=data, headers=headers
74+ )
75+
76+ oidc-op will return a json response like this::
77+
78+ {
79+ 'access_token': 'eyJhbGc ... CIOH_09tT_YVa_gyTqg',
80+ 'token_type': 'Bearer',
81+ 'scope': 'openid profile email address phone offline_access',
82+ 'refresh_token': 'Z0FBQ ... 1TE16cm1Tdg=='
83+ }
84+
85+
86+
5287Introspection endpoint
5388----------------------
5489
Original file line number Diff line number Diff line change 9191 "acr" : " urn:oasis:names:tc:SAML:2.0:ac:classes:InternetProtocolPassword" ,
9292 "class" : " oidcop.user_authn.user.UserPassJinja2" ,
9393 "kwargs" : {
94- "verify_endpoint" : " verify/user" ,
94+ "verify_endpoint" : " / verify/user" ,
9595 "template" : " user_pass.jinja2" ,
9696 "db" : {
9797 "class" : " oidcop.util.JSONDictDB" ,
You can’t perform that action at this time.
0 commit comments