Issues with google calender and services connection in weweb

Options
iconic
iconic Member

I'm currently trying to get events from google calendar, so the logic is when a user signs in using google auth in weweb they should be directed to give access to their calendar to get their events and then populate a database with the events in their calendar. so far i have been able to set up google auth, services and the calendar api , but the events im getting from the calendar are not dynamic from each users, instead it only from one user.

Answers

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Hi

    I'm working with Google Calendar right now and did exactly what you want to do can you show me your function stack?

    What api's from google are you using to get access token?

  • iconic
    iconic Member
    Options

    thank you for your response, i actually need general guidance regarding the api and how to setup the function stack, but im trying to get a users calendar list and also get events from their calendars. i was able to set up the scope in the oath setup. but i cant seem to utilize the token gotten from that flow to call those apis.

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Can you show me enpoints and parameters that you are using for your authentication? Are you using get token endpoint to exchange auth code for access and refresh token?

  • iconic
    iconic Member
    Options

    yes i tried imitating the oauth flow but instead of user id i set it up as calendar events. so basically I'm using the get token endpoint to then get an auth code which is exchanged for an auth token, but the final flow i added to it which was that it should add an event to my database. but to be honest im just winging it and i have 0 idea on how to approach it because my knowledge base regarding 0auth flow is not so strong so any tips that could help me understand better and how to structure my function stack would help.

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Can you show your function stack? It's a bit hard to determine without actually seeing what is going on in the endpoint

  • iconic
    iconic Member
    Options

    okay i made a video showing my function stack

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Ok,

    Thank you for the video, but I still don't know where exatly are you encountering error.

    1. Are you able to open google login page?
    2. Are getting the code back and exchanging that code for refresh and access token?
    3. Are you saving both of those tokens in your user table for further use?
    4. Are successfully calling calendar API and getting calendars in response?

  • iconic
    iconic Member
    Options

    I'm not able to open the login page, so i cant even retrieve the access code to call the second endpoint to get the access token. i also tried saving the access token in my user table to allow it make api calls and it keeps returning an unauthorized response

  • Pawel Magdanski
    Pawel Magdanski Member ✭✭✭
    Options

    Ok,

    So in auth enpoint you need to use client_id as a parameter instead of Bearer Token in header, since you as a user are not logged in yet. And try to change access type to offline as well.

  • iconic
    iconic Member
    Options

    i finally found my way around it and how to manage the response, thank you!!!!