directus / v8-archive

Directus Database API — Wraps Custom SQL Databases with a REST/GraphQL API
https://docs.directus.io/api/reference.html
507 stars 204 forks source link

"Unauthorized request" after login with SSO token #1981

Open animeshsarkar-bct opened 4 years ago

animeshsarkar-bct commented 4 years ago

Hi, I was trying to integrate the SSO login in a Vue app and it is working and I can able to get request_token. But this token is not working when I try to call another API. steps

  1. Call SSO Provider using https://mydomain.com/projectname/auth/sso/google?mode=jwt&redirect_url=https://myvueappdomain.com/callback
  2. Getting https://myvueappdomain.com/callback?request_token=xxxxxxx. I got that token
  3. Store that token in local storage
  4. Try to call API with that local storage stored token
    "url": "https://mydomain.com/projectname/users/me ",
    "method": "GET",
    "headers": {
    "content-type": "application/json",
    "authorization": "Bearer xxxxxxx",

    but it gave me "Unauthorized request" code 3

Please help me if I am doing anything wrong

animeshsarkar-bct commented 4 years ago

I found the solution in your code I called /auth/sso/access_token with resuest_token and it works. But, it was not written on your documentation