Hi, I'm using Google OAuth and Appwrite 1.4.1 and before with 1.3.8 I never got this error: Invalid success param: URL host must be one of: localhost, backend.justitis.it
Can you show your code?
import 'dart:convert';
import 'package:appwrite/models.dart';
import 'package:flutter/material.dart';
import 'package:justitis_app/services/appwrite_service.dart';
enum AuthStatus{
uninit, auth, unauth
}
class AuthProvider extends ChangeNotifier{
late User _currentUser;
double _wallet = 0.0;
double _moneyToAdd = 0.0;
AuthStatus _authStatus = AuthStatus.uninit;
// Getter
User get currentUser => _currentUser;
AuthStatus get authStatus => _authStatus;
double get wallet => _wallet;
double get moneyToAdd => _moneyToAdd;
set moneyToAdd(double money) => _moneyToAdd = money;
// Remote Server (deprecated)
// final String userCollectionId = '64d295100d412a890d19';
// final String _successRedirectUrl = 'https://test.justitis.it/auth.html';
//Local Server
final String _userCollectionId = 'users';
final String _successRedirectUrl = 'http://test.justitis.it/auth.html';
AuthProvider(){
checkIfLogged();
}
void checkIfLogged() async{
try{
_currentUser = await AppwriteService.account.get();
_authStatus = AuthStatus.auth;
updateWallet();
}catch(e){
_authStatus = AuthStatus.unauth;
}finally{
notifyListeners();
}
}
void updateWallet() async{
try{
var result = await AppwriteService.database.getDocument(databaseId: AppwriteService.databaseId, collectionId: _userCollectionId, documentId: _currentUser.$id);
var document = result.toMap();
_wallet = (document['data']['balance'] + 0.0);
}finally{
notifyListeners();
}
}
void logIn() async{
try{
//final session =
await AppwriteService.account.createOAuth2Session(provider: 'google', success: _successRedirectUrl);
_currentUser = await AppwriteService.account.get();
_authStatus = AuthStatus.auth;
updateWallet();
}finally{
notifyListeners();
}
}
I think itβs because you didnβt provide a failure url.
Either have both success and failure, or none
ok, i'll try
nope, same error
Both ways? Removing the success and failure params gave same error?
This is what I meant
void logIn() async{
try{
//final session =
await AppwriteService.account.createOAuth2Session(provider: 'google');
_currentUser = await AppwriteService.account.get();
_authStatus = AuthStatus.auth;
updateWallet();
}finally{
notifyListeners();
}
}
now started working
thank you!
[SOLVED] Invalid success param
Success and failure URL must be a subdomain of your Appwrite instance AND added as a Web platform.
I think that might be why
Recommended threads
- I'm experiencing a critical bug on Appwr...
Hey <@870607367597850624> team / support π I'm experiencing a critical bug on Appwrite Cloud that's blocking my production Flutter app. I've already filed GitH...
- context deadline exceeded
Hi, in one of my projects i continuously receive context deadline exceeded when trying to reach users API from my local machine: https://fra.cloud.appwrite.io/v...
- function subdomain ssl certs
The generated subdomain isn't getting a valid ssl cert, I was wondering if appwrite automatically generates one or uses a wildcard for *.functions.domain.com? ...