Back

Using REST API to initiate OAUTH

  • 0
  • Self Hosted
  • Auth
  • REST API
  • Cloud
xStar37
6 Sep, 2024, 16:13

Using the available documentation for creating an OAuth2 Token, the successful response I get is not documented and I do not understand how the authentication flow should proceed.

After the initial GET request to https://cloud.appwrite.io/v1/account/tokens/oauth2/oidc, I receive a HTTP 200 response containing: -URL: https://oauth.provider/ui/login/login?authRequestID=280000000043

  • Cookies: CSRF and Useragent
  • html of the login page from the oauth provider

How do I proceed with the authentication flow using the data AppWrite has sent in response?

After manually changing the Useragent cookie value, authentication proceeds, until it hits appwrite and the following error is shown:

Missing redirect URL Your OAuth login flow is missing a proper redirect URL. Please check the OAuth docs and send request for new session with a valid callback URL.

https://cloud.appwrite.io/console/auth/oauth2/failure?error={"message":"Failed to obtain access token. The OpenID Connect OAuth2 provider returned an error: invalid_request: code_challenge required","type":"user_oauth2_bad_request","code":400}

TL;DR
Developers trying to use REST API to initiate OAuth encounter an issue with the authentication flow. After receiving a successful response with a login page, they face an error stating 'Missing redirect URL' when trying to proceed. The error message suggests that the OAuth login flow is missing a proper redirect URL. To resolve this, they need to ensure the callback URL is valid and aligns with the OAuth documentation.
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more