TOKEN_VERIFICATION_FAILED Unable to verify JWT token with SSO to access private content

Hi
I’ve read the following article: Set up single sign-on (SSO) to access private content
Looks pretty straight forward, but I cannot setup SSO correctly, not sure what I am doing wrong.
I’ve set up SSO with following paramters:

My application code:
```python
@app.get(“/”)
def read_root(request: Request):
if redirect_url := request.query_params.get(“redirect_url”):
jwt_encoded = jwt.encode({“email”: “test@wegroup.be”}, SECRET, algorithm=“HS256”)
url = f"{redirect_url}?jwt={jwt_encoded}"
r = requests.get(url)
url = f"https://help.wegroup.be/_hcms/mem/jwt?redirect_url={redirect_url}&jwt={jwt_encoded}"
print(f"REDIRECTING: {url}")
return RedirectResponse(url)
else:
return JSONResponse({“status”: “ERROR”, “msg”: “Query parameter ‘redirect_url’ required”})
```
I get the following error:

I know best practice is to use a library, I am all in on libraries, but I also like to know how things work. And something like this should be straight forward, but apparently I am missing something…

When doing the request to redirect_url with query parameter ‘jwt’ I get a successful response:

<div>
 <h3>SSO Setup Successful</h3>
</div>
<script>
 if (window.opener) {
 window.opener.postMessage({ type: 'JWT_CONFIRMATION', success: true }, '*');
 window.close();
 }
</script>

the last call to `_hcms/mem/jwt?redirect_url=XXX&jwt=XXX` still fails

Hi @SVanHoecke did you fix the prblem with “the last call to `_hcms/mem/jwt?redirect_url=XXX&jwt=XXX` still fails”?

Fixed the problem by redirecting to `_hcms/mem/jwt/verify` instead of `_hcms/mem/jwt`. The documentation is no clear what to do.