#Appwrite Oauth2 problem

6 messages · Page 1 of 1 (latest)

burnt sable
#

I'm trying to create an Oauth2session using the sdk's but the createOauth2Session is not available on the account object for some reason await account.createOAuth2Session(Error: creatOauth2session is not available on type account)( OAuthProvider.Google, "http://localhost:3000", "http://localhost:3000" );


const client = new sdk.Client();

client
  .setEndpoint(process.env.NEXT_PUBLIC_ENDPOINT!)
  .setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT!)
  .setKey(process.env.NEXT_SECRET_APPWRITE_KEY!);

export const databases = new sdk.Databases(client);
export const users = new sdk.Users(client);
export const messaging = new sdk.Messaging(client);
export const storage = new sdk.Storage(client);
export const account = new sdk.Account(client);
burnt sable
#

Is there some fix for this

inner citrus
#

Looks like you're using the server side sdk, check out the server side docs.

https://appwrite.io/docs/references/cloud/server-nodejs/account#createOAuth2Token

The Account service allows you to authenticate and manage a user account. You can use the account service to update user information, retrieve the user sessions across different devices, and fetch the user security logs with his or her recent activity.

Register new user accounts with the [Create Account](/docs/references/cloud/client-web/accoun...

#

When they login successfully get the secret and set it on your client using client.setSession(secret)

#

Then Appwrite will act on behalf of the authenticated user