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
- CreateRow is doing ListRows on self-host...
### setup ``` appwrite 1.9.5 self-hosted bun 1.3 node-appwrite 27.1.0 ``` ### issue Im running a function on a self hosted 1.9.5 with "node-appwrite": "^27.1.0...
- Local function execution results in HTTP...
Hi all, I'm trying to develop a new function on my Ubuntu 24.04 machine running the latest version of docker. I've read through the documentation to install and...
- hi guys! my site is not accesible in my ...