Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add OAuth for Google quickstart #138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

gewenyu99
Copy link
Contributor

@gewenyu99 gewenyu99 commented Sep 30, 2023

What does this PR do?

Add OAuth for Google quickstart, written by @Dksie09

Test Plan

Manual review.

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

Yes

@vercel
Copy link

vercel bot commented Sep 30, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
website ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 30, 2023 4:07pm

back: /docs/quick-starts
---

Appwrite allows you to authenticate users using their Google account through the Google OAuth2 provider. OAuth authentication is a great way to reduce friction for your users and increase user conversion by simplifying the signup process. You can learn more about Appwrite's other OAuth2 providers [here](https://appwrite.io/docs/client/account?sdk=web-default#accountCreateOAuth2Session).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Appwrite allows you to authenticate users using their Google account through the Google OAuth2 provider. OAuth authentication is a great way to reduce friction for your users and increase user conversion by simplifying the signup process. You can learn more about Appwrite's other OAuth2 providers [here](https://appwrite.io/docs/client/account?sdk=web-default#accountCreateOAuth2Session).
Appwrite allows you to authenticate users using their Google account through the Google OAuth2 provider. OAuth authentication is a great way to reduce friction for your users and increase user conversion by simplifying the signup process. You can learn more about Appwrite's other OAuth2 providers [here](https://appwrite.io/docs/references/cloud/client-web/account#createOAuth2Session).

You can do this by following the [Setting up OAuth 2.0](https://support.google.com/googleapi/answer/6158849) guide from Google.

1. When prompted to provide an **Application type**, select **web application**, irrespective of your target platform. This is because the communication occurs between Appwrite (a web app) and the OAuth2 provider on behalf of your web or mobile app.
1. When prompted to provide a **Authorized redirect URIs** field, provide the **URI** found in the **Google OAuth2 Settings** modal from your Appwrite console.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. When prompted to provide a **Authorized redirect URIs** field, provide the **URI** found in the **Google OAuth2 Settings** modal from your Appwrite console.
1. When prompted to provide **Authorized redirect URIs**, provide the **URI** found in the **Google OAuth2 Settings** modal from your Appwrite console.

// Go to OAuth provider login page
account.createOAuth2Session("google", "[LINK_ON_SUCCESS]", "[LINK_ON_FAILURE]");
```
{% /tabsitem %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably add a note about how they might need to configure a custom domain if 3rd party cookies are being blocked.


{% tabs %}
{% tabsitem #js title="Javascript" %}
When a user calls the [Create OAuth2 Session](https://appwrite.io/docs/client/account#accountCreateOAuth2Session) endpoint in your web app, they will be taken to Google's OAuth page to complete their login.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When a user calls the [Create OAuth2 Session](https://appwrite.io/docs/client/account#accountCreateOAuth2Session) endpoint in your web app, they will be taken to Google's OAuth page to complete their login.
When a user calls the [Create OAuth2 Session](https://appwrite.io/docs/references/cloud/client-web/account#createOAuth2Session) endpoint in your web app, they will be taken to Google's OAuth page to complete their login.

{% /tabsitem %}

{% tabsitem #flutter title="Flutter" %}
You can use OAuth in your Flutter application, but some platforms like Android and Apple requires additional configuration to enable the OAuth callback, so the your users can be redirected back to your app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can use OAuth in your Flutter application, but some platforms like Android and Apple requires additional configuration to enable the OAuth callback, so the your users can be redirected back to your app.
You can use OAuth in your Flutter application, but some platforms like Android and Apple require additional configuration to enable the OAuth callback, so your users can be redirected back to your app.

}
```

To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/client/account?sdk=apple-default#accountCreateOAuth2Session) endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/client/account?sdk=apple-default#accountCreateOAuth2Session) endpoint.
To authenticate a user in your iOS application, use the [Create OAuth2 Session](https://appwrite.io/docs/references/cloud/client-apple/account#createOAuth2Session) endpoint.

</manifest>
```

To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/client/account?sdk=android-kotlin#accountCreateOAuth2Session) endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/client/account?sdk=android-kotlin#accountCreateOAuth2Session) endpoint.
To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/references/cloud/client-android-kotlin/account#createOAuth2Session) endpoint.

</manifest>
```

To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/client/account?sdk=android-java#accountCreateOAuth2Session) endpoint.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/client/account?sdk=android-java#accountCreateOAuth2Session) endpoint.
To authenticate a user in your Android application, use the [Create OAuth2 Session](https://appwrite.io/docs/references/cloud/client-android-java/account#createOAuth2Session) endpoint.


OAuth2 sessions expire to protect from security risks.
This means, OAuth2 sessions should be refreshed to keep the user authenticated.
You can do this by calling the [Update OAuth Session](https://appwrite.io/docs/client/account#accountUpdateSession) endpoint when ever your user visits your app.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can do this by calling the [Update OAuth Session](https://appwrite.io/docs/client/account#accountUpdateSession) endpoint when ever your user visits your app.
You can do this by calling the [Update OAuth Session](https://appwrite.io/docs/references/cloud/client-android-java/account#updateSession) endpoint whenever your user visits your app.

Comment on lines +298 to +299
// OAuth Login, for simplest implementation you can leave both success and
// failure link empty so that Appwrite handles everything.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// OAuth Login, for simplest implementation you can leave both success and
// failure link empty so that Appwrite handles everything.

@TorstenDittmann TorstenDittmann added the documentation Improvements or additions to documentation label Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants