Appwrite
  1. account
Appwrite
  • account
    • Delete Account
      DELETE
    • Get Account
      GET
    • Create Account
      POST
    • Update Account Email
      PATCH
    • Create Account JWT
      POST
    • Get Account Logs
      GET
    • Update Account Name
      PATCH
    • Update Account Password
      PATCH
    • Get Account Preferences
      GET
    • Update Account Preferences
      PATCH
    • Create Password Recovery
      POST
    • Complete Password Recovery
      PUT
    • Delete All Account Sessions
      DELETE
    • Get Account Sessions
      GET
    • Create Account Session
      POST
    • Create Anonymous Session
      POST
    • Create Account Session with OAuth2
      GET
    • Delete Account Session
      DELETE
    • Get Session By ID
      GET
    • Create Email Verification
      POST
    • Complete Email Verification
      PUT
  • avatars
    • Get Browser Icon
      GET
    • Get Credit Card Icon
      GET
    • Get Favicon
      GET
    • Get Country Flag
      GET
    • Get Image from URL
      GET
    • Get User Initials
      GET
    • Get QR Code
      GET
  • database
    • List Documents
    • Create Document
    • Delete Document
    • Get Document
    • Update Document
  • functions
    • List Executions
    • Create Execution
    • Get Execution
  • locale
    • Get User Locale
    • List Continents
    • List Countries
    • List EU Countries
    • List Countries Phone Codes
    • List Currencies
    • List Languages
  • storage
    • List Files
    • Create File
    • Delete File
    • Get File
    • Update File
    • Get File for Download
    • Get File Preview
    • Get File for View
  • teams
    • List Teams
    • Create Team
    • Delete Team
    • Get Team
    • Update Team
    • Get Team Memberships
    • Create Team Membership
    • Delete Team Membership
    • Update Membership Roles
    • Update Team Membership Status
  1. account

Create Account Session with OAuth2

GET
/account/sessions/oauth2/{provider}
account
Allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
If there is already an active session, the new session will be attached to the logged-in account. If there are no active sessions, the server will attempt to look for a user with the same email address as the email received from the OAuth2 provider and attach the new session to the existing user. If no matching user is found - the server will create a new user..
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request GET 'https://appwrite.io/v1/account/sessions/oauth2/'
Response Response Example
{}

Request

Path Params
provider
string 
required
OAuth2 Provider. Currently, supported providers are: amazon, apple, bitbucket, bitly, box, discord, dropbox, facebook, github, gitlab, google, linkedin, microsoft, paypal, paypalSandbox, salesforce, slack, spotify, tradeshift, tradeshiftBox, twitch, vk, yahoo, yandex, wordpress.
Query Params
success
string 
optional
URL to redirect back to your app after a successful login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.
failure
string 
optional
URL to redirect back to your app after a failed login attempt. Only URLs from hostnames in your project platform list are allowed. This requirement helps to prevent an open redirect attack against your project API.
scopes
array[string]
optional
A list of custom OAuth2 scopes. Check each provider internal docs for a list of supported scopes.

Responses

🔵301File
application/json
Body
object {0}
Modified at 2023-08-16 07:28:13
Previous
Create Anonymous Session
Next
Delete Account Session
Built with